<?php
/**
 * Created by PhpStorm.
 * User: guokunsheng
 * Date: 2018/8/6
 * Time: 23:09
 */

namespace app\everyday\controller;

use app\common\lib\horoscope\Horoscope;
use app\check\controller\Check;

/**
 * 每日运势-某某之日 1-3条
 * Class Topic
 * @package app\everyday\controller
 */
class Topic extends Check
{
    // 行运数据
    public $transitsData = [];
    // 三限数据
    public $thirdprogressedData = [];
    // 天象数据
    public $nowData = [];
    // 本命数据
    public $natalData = [];

    public $year = 2017;

    public $sex;

    public $newMoonSign = -1;
    public $newMoonTransitsData = [];

    public $solarEclipse = false;
    public $lunarEclipse = false;

    public $solarTransitsData = [];
    public $lunarTransitsData = [];

    public $fiveIndex = [];
    public $fiveIndexScore = [];

    public $isBirth = false;

    public $active = null;
    public $luckDisasters = null;
    public $recode = [];
    public $advance = [];

    /**
     * @param bool $index type=false 详情页 type=true 首页
     * @return array
     * @throws \app\common\lib\exception\ApiException
     */
    public function init($index = false)
    {
        $result = $this->get();

        $result = resort($result, 'star_level');
        // 若为首页请求
        if ($index !== false)
        {
            $test1 = [];
            $test2 = [];
            $test3 = [];
            foreach ($result as $k => $v)
            {
                if ($v['star_level'] == 3 && substr($v['name'], 0, 6) !== '许愿')
                {
                    $test1[] = $v;
                } elseif ($v['star_level'] == 3 && substr($v['name'], 0, 6) == '许愿')
                {
                    $test2[] = $v;
                } else
                {
                    $test3[] = $v;
                }
                // 团圆之日修改为欢聚之日
                if ($v['star_level'] == 3 && substr($v['name'], 0, 6) !== '欢聚')
                {
                    $test1[] = $v;
                    $test2 = $test3 = [];
                    break;
                }
            }
            $result = array_merge($test1, $test2, $test3);
            $result = $result[0];
        }
        return $result;
    }

    //1、爱情、欢乐；2、成长、收获；3、变动、忙碌；4、郁闷、忧伤；5、苦难、失去；6、祈祷、节日 7、平淡中积蓄力量

    /**
     * @return array
     * @throws \app\common\lib\exception\ApiException
     */
    protected function get()
    {
        $tr_planet = $this->transitsData[1]['planets'];// 行运外盘数据
        $tr_planet2 = $this->transitsData[0]['planets'];// 行运内盘数据
        $tp_planet = $this->thirdprogressedData['planets'];// 三限数据
        $na_planet = $this->natalData['planets'];// 本命数据
        $tx_planet = $this->nowData['planets'];// 天象数据
        $planet_mingzhu = $this->natalData['houses'][1]['protect_id'];// 本命命主星

        $icon_urls = config('fortune.icon_url');
        $icon_url1 = $icon_urls['joy'];
        $icon_url2 = $icon_urls['gain'];
        $icon_url3 = $icon_urls['busy'];
        $icon_url4 = $icon_urls['depression'];
        $icon_url5 = $icon_urls['lose'];
        $icon_url6 = $icon_urls['pray'];
        $icon_url7 = $icon_urls['power'];

        $tip_urls = config('fortune.tip_url');
        $icon_url1_pop = $tip_urls['joy_pop'];
        $icon_url2_pop = $tip_urls['gain_pop'];
        $icon_url3_pop = $tip_urls['busy_pop'];
        $icon_url4_pop = $tip_urls['depression_pop'];
        $icon_url5_pop = $tip_urls['lose_pop'];
        $icon_url6_pop = $tip_urls['pray_pop'];
        $icon_url7_pop = $tip_urls['power_pop'];

        $day_names = config('fortune.day');
        $day_huanqing = $day_names[0];
        $day_fenhong = $day_names[1];
        $day_kuaile = $day_names[2];
        $day_jiqing = $day_names[3];
        $day_yuyue = $day_names[4];
        $day_suxing = $day_names[5];
        $day_qiji = $day_names[6];
        $day_qidi = $day_names[7];
        $day_shouhuo = $day_names[8];
        $day_chaoyue = $day_names[9];
        $day_bianhua = $day_names[10];
        $day_benzou = $day_names[11];
        $day_chongji = $day_names[12];
        $day_shoushen = $day_names[13];
        $day_jianshen = $day_names[14];
        $day_xuexi = $day_names[15];
        $day_yiyao = $day_names[16];
        $day_tiaozhan = $day_names[17];
        $day_miluan = $day_names[18];
        $day_zhefu = $day_names[19];
        $day_qingshang = $day_names[20];
        $day_shounan = $day_names[21];
        $day_zhuixin = $day_names[22];
        $day_sancai = $day_names[23];
        $day_shangtong = $day_names[24];
        $day_chenjie = $day_names[25];
        $day_laoyin = $day_names[26];
        $day_ziyou = $day_names[27];
        $day_chuansuo = $day_names[28];
        $day_yaoyue = $day_names[29];
        $day_liaoluan = $day_names[30];
        $day_jifen = $day_names[31];
        $day_chenyu = $day_names[32];
        $day_pingfan = $day_names[33];

        $day_deses = config('fortune.day_des');
        $day_huanqing_des = $day_deses[0];
        $day_fenhong_des = $day_deses[1];
        $day_kuaile_des = $day_deses[2];
        $day_jiqing_des = $day_deses[3];
        $day_yuyue_des = $day_deses[4];
        $day_suxing_des = $day_deses[5];
        $day_qiji_des = $day_deses[6];
        $day_qidi_des = $day_deses[7];
        $day_shouhuo_des = $day_deses[8];
        $day_chaoyue_des = $day_deses[9];
        $day_bianhua_des = $day_deses[10];
        $day_benzou_des = $day_deses[11];
        $day_chongji_des = $day_deses[12];
        $day_shoushen_des = $day_deses[13];
        $day_jianshen_des = $day_deses[14];
        $day_xuexi_des = $day_deses[15];
        $day_yiyao_des = $day_deses[16];
        $day_tiaozhan_des = $day_deses[17];
        $day_miluan_des = $day_deses[18];
        $day_zhefu_des = $day_deses[19];
        $day_qingshang_des = $day_deses[20];
        $day_shounan_des = $day_deses[21];
        $day_zhuixin_des = $day_deses[22];
        $day_sancai_des = $day_deses[23];
        $day_shangtong_des = $day_deses[24];
        $day_chenjie_des = $day_deses[25];
        $day_laoyin_des = $day_deses[26];
        $day_ziyou_des = $day_deses[27];
        $day_chuansuo_des = $day_deses[28];
        $day_yaoyue_des = $day_deses[29];
        $day_liaoluan_des = $day_deses[30];
        $day_jifen_des = $day_deses[31];
        $day_chenyu_des = $day_deses[32];
        $day_pingfan_des = $day_deses[33];


        $levels = $this->getNormal();

        $result = [];

        $love_score = 0;

        if ($this->sex == 2)
        {
            $love_score = Horoscope::getInstance(['recode' => $this->recode, 'advance' => $this->advance])->getTaohua();
        }
        $is_tr_3_house_5_7__no90_phase = false;

        if (is_countable($tr_planet[3]['phase']) && count($tr_planet[3]['phase']) > 0)
        {
            foreach ($tr_planet[3]['phase'] as $tr_3_phase)
            {
                if ($tr_3_phase['phase_e'] != 90 && in_array($tr_planet[$tr_3_phase['id']]['in_house_id'], [5, 7]))
                {
                    $is_tr_3_house_5_7__no90_phase = true;
                }
            }
        }

        $is_moon_in_trine = false;// 月亮是否参与大三角
        $is_moon_in_small_triangle = false;// 月亮是否参与小三角
        $is_moon_in_t_square = false;// 月亮是否参与T三角
        $is_moon_in_bridge_triangle = false;// 月亮是否参与桥三角

        $is_venu_in_t_square = false;// 金星是否参与T三角
        $is_mars_in_t_square = false;// 火星是否参与T三角
        $is_satu_in_t_square = false;// 土星是否参与T三角
        $is_nept_in_t_square = false;// 海王星是否参与T三角
        $is_plut_in_t_square = false;// 冥王星是否参与T三角

        if (!empty($this->thirdprogressedData['structure']['trine']))
        {
            foreach ($this->thirdprogressedData['structure']['trine'] as $trine)
            {
                if (in_array(1, $trine)) $is_moon_in_trine = true;
            }
        }

        if (!empty($this->thirdprogressedData['structure']['small_triangle']))
        {
            foreach ($this->thirdprogressedData['structure']['small_triangle'] as $small_triangle)
            {
                if (in_array(1, $small_triangle)) $is_moon_in_small_triangle = true;
            }
        }

        if (!empty($this->thirdprogressedData['structure']['t_square']))
        {
            foreach ($this->thirdprogressedData['structure']['t_square'] as $t_square)
            {
                if (in_array(1, $t_square)) $is_moon_in_t_square = true;
                if (in_array(3, $t_square)) $is_venu_in_t_square = true;
                if (in_array(4, $t_square)) $is_mars_in_t_square = true;
                if (in_array(6, $t_square)) $is_satu_in_t_square = true;
                if (in_array(8, $t_square)) $is_nept_in_t_square = true;
                if (in_array(9, $t_square)) $is_plut_in_t_square = true;
            }
        }

        if (!empty($this->thirdprogressedData['structure']['bridge_triangle']))
        {
            foreach ($this->thirdprogressedData['structure']['bridge_triangle'] as $bridge_triangle)
            {
                if (in_array(1, $bridge_triangle)) $is_moon_in_bridge_triangle = true;
            }
        }
        //当用户生日与当前日期为同一天时，推送为 3星欢庆之日：这是你诞生的日子，生命的萌芽，旅程的开始。不管你是平凡是伟大，你都将成为一段传奇。这么多人爱你，你也温暖着身边每一个人。今天开始，你又将踏上新一段人生旅程，我们为你欢庆，也将一直陪伴在你左右。
        if ($this->isBirth)
        {
            $level = 3;
            $result[] = [
                'name' => $day_huanqing,
                'star_level' => $level,
                'tips' => $day_huanqing_des,
                'icon_url' => $icon_url1,
                'tips_url' => $icon_url1_pop
            ];
        }
        // 日运查看日期
        $advanceDay = $this->advance['year'] . '-' . $this->advance['month'] . '-' . $this->advance['day'];
        // 除夕、腊月三十/腊月廿九
        $day1 = ['2019-02-04', '2020-01-24', '2021-02-11', '2022-01-31', '2023-01-21', '2024-02-09', '2025-01-28', '2026-02-16', '2027-02-05', '2028-01-25', '2029-02-12', '2030-02-02'];
        // 春节、大年初一
        $day3 = ['2019-02-05', '2020-01-25', '2021-02-12', '2022-02-01', '2023-01-22', '2024-02-10', '2025-01-29', '2026-02-17', '2027-02-06', '2028-01-26', '2029-02-13', '2030-02-03'];

        $isNewYearsEve = in_array($advanceDay, $day1);
        $isTheSpringFestival = in_array($advanceDay, $day3);
        // 辞旧之日 34
        //【腊月三十】
        if ($isNewYearsEve)
        {
            $level = 3;
            $result[] = [
                'name' => $day_names[34],
                'star_level' => $level,
                'tips' => $day_deses[34],
                'icon_url' => $icon_url1,
                'tips_url' => $icon_url1_pop
            ];
        }
        // 团圆之日 35
        //【腊月三十/大年初一；放在第一条和首页】
        if ($isNewYearsEve || $isTheSpringFestival)
        {
            $level = 3;
            $result[] = [
                'name' => $day_names[35],
                'star_level' => $level,
                'tips' => $day_deses[35],
                'icon_url' => $icon_url1,
                'tips_url' => $icon_url1_pop
            ];
        }
        // 迎新之日 36
        //【大年初一】
        if ($isTheSpringFestival)
        {
            $level = 3;
            $result[] = [
                'name' => $day_names[36],
                'star_level' => $level,
                'tips' => $day_deses[36],
                'icon_url' => $icon_url1,
                'tips_url' => $icon_url1_pop
            ];
        }

        //粉红之日
        //	tp57宫无土星独坐+月亮与金星成非刑相且日金或金木金火成相（金火非刑冲），
        //  或tp57宫无土星独坐+月亮过57宫与火星合拱六分或与木星非刑相，
        //  或女命八字婚恋年（15分以上）且月亮与金星非刑相或过5/7宫与日水成非刑相 20180911（此时不与火土天海冥成相）
        //		tr金星过轴或与“本命日月金水火或5/7宫内星成非刑相”且本命金星与tr日水木火成非刑相///（本命行运两个金星最紧密相位容许度之和小于1或本命金星被引动多于两颗星为3星，小于1.5为2星，小于2.5为1星）
        //tr金星与金星成非刑相///（1度内为2星，2度内为1星）
        //
        //	桃花很可能在此时盛开，即便没有，也容易接收到异性的示好，或与亲朋好友欢聚一堂。
        if (((!checkSignHouse([6], [5, 7], $tp_planet) || checkSignHouse([0, 1, 2, 3, 4, 5, 7, 8, 9], [5, 7], $tp_planet))
                && ((checkPhase([1], [3], [0, 60, 120, 180], $tp_planet)
                        && (checkPhase([0], [3], [], $tp_planet)
                            || checkPhase([3], [5], [], $tp_planet)
                            || checkPhase([3], [4], [0, 60, 120], $tp_planet)))
                    || (checkSignHouse([1], [5, 7], $tp_planet)
                        && (checkPhase([1], [4], [0, 60, 120], $tp_planet)
                            || checkPhase([1], [5], [0, 60, 120, 180], $tp_planet)))))
            || ($this->sex == 2 && $love_score > 15
                && (checkPhase([1], [3], [0, 60, 120, 180], $tp_planet)
                    || (checkSignHouse([1], [5, 7], $tp_planet)
                        && checkPhase([1], [0, 2], [0, 60, 120, 180], $tp_planet)
                        && !checkPhase([1], [4, 6, 7, 8, 9], [], $tp_planet)
                    )
                )))

        {
            $level = 0;
            if ((checkPhase([3], [ASC, MC], [0, 180], $tr_planet, 1)
                    || (checkPhase([3], [0, 1, 2, 3, 4], [0, 60, 120, 180], $tr_planet)
                        || $is_tr_3_house_5_7__no90_phase))
                && checkPhase([0, 2, 4, 5], [3], [0, 60, 120, 180], $tr_planet)
            )
            {
                if (!empty($tr_planet[3]['phase']) && !empty($na_planet[3]['phase']))
                {
                    $phase_e_sum = current(reset($tr_planet[3]['phase']))['phase_e'] + current(reset($na_planet[3]['phase']))['phase_e'];
                    if ($phase_e_sum < 1 || count($na_planet[3]['phase']) > 2)
                    {
                        $level = 3;
                    } elseif ($phase_e_sum <= 1.5)
                    {
                        $level = 2;
                    } elseif ($phase_e_sum <= 2.5)
                    {
                        $level = 1;
                    }
                }
            }
            if ($level <= 1 && checkPhase([3], [3], [0, 60, 120, 180], $tr_planet, 1))
            {
                $level = 2;
            } elseif (!$level && checkPhase([3], [3], [0, 60, 120, 180], $tr_planet, 2))
            {
                $level = 1;
            }

            if ($level)
            {
                $result[] = [
                    'name' => $day_fenhong,
                    'star_level' => $level,
                    'tips' => $day_fenhong_des,
                    'icon_url' => $icon_url1,
                    'tips_url' => $icon_url1_pop
                ];
            }
        }

        //快乐之日 快乐之日，如果有tr日行冲本命火土，或者愤怒或郁闷分高于5，则-1星 零星不显示 20180905
        //	tp月金成非刑相或月木成非刑相或月金木同时成相，且tr金星过轴点或tr金星与本命日月金木成非刑相（tr无火星对日月命主1度内的合刑冲）
        //		tr金星相位1度内2星（若此时tp月亮不与火土海冥之一合刑冲，3星），其余1星；
        //	tp月金成非刑相或月木成非刑相或月金木同时成相，且tr日金（木）成非刑相或tr水月同时与金（木）星成非刑相或tr火月同时与金（木）星合拱六分
        //		日金（木）成相时1度内2星，2度内1星；其它方式以水金（木）或火金（木）计算，1度内2星，2度内1星；若此时tp月亮无火土海冥合刑冲，以上所有额外+1星
        //	会有开心的事情发生，虽然大多离不开吃喝玩乐。旅行，聚会，庆祝，结识新朋友，谈恋爱，打游戏……你有种种可能，总之今天一定有办法让自己开心。告白、求婚、调解关系、洽谈合作也是不错的选择。
        if ((checkPhase([1], [3, 5], [0, 60, 120, 180], $tp_planet)
            || (checkPhase([1], [3], [], $tp_planet) && checkPhase([1], [5], [], $tp_planet))))
        {
            $level = 0;
            if (checkPhase([3], [ASC, MC], [0, 180], $tr_planet, 1)
                || (checkPhase([3], [0, 1, 3, 5], [0, 60, 120, 180], $tr_planet)
                    && !checkPhase([4], [0, 1, $planet_mingzhu], [0, 90, 180], $tr_planet, 1)))
            {
                if (checkPhase([3], [ASC, MC], [0, 180], $tr_planet, 1)
                    || checkPhase([3], [0, 1, 3, 5], [0, 60, 120, 180], $tr_planet, 1))
                {
                    $level = 2;
                    if (!checkPhase([1], [4, 6, 8, 9], [0, 90, 180], $tp_planet))
                    {
                        $level = 3;
                    }
                } else
                {
                    $level = 1;
                }
            }
            if ($level < 3)
            {
                if (checkPhase([0], [3, 5], [0, 60, 120, 180], $tr_planet))
                {
                    if (checkPhase([0], [3, 5], [0, 60, 120, 180], $tr_planet, 1))
                    {
                        $level = 2;
                    } elseif ($level < 2 && checkPhase([0], [3, 5], [0, 60, 120, 180], $tr_planet, 2))
                    {
                        $level = 1;
                    }
                }
                if ((checkPhase([1], [3], [0, 60, 120, 180], $tr_planet) && checkPhase([2], [3], [0, 60, 120, 180], $tr_planet)))
                {
                    if (checkPhase([2], [3], [0, 60, 120, 180], $tr_planet, 1))
                    {
                        $level = 2;
                    } elseif ($level < 2 && checkPhase([2], [3], [0, 60, 120, 180], $tr_planet, 2))
                    {
                        $level = 1;
                    }
                }
                if ((checkPhase([1], [5], [0, 60, 120, 180], $tr_planet) && checkPhase([2], [5], [0, 60, 120, 180], $tr_planet)))
                {
                    if (checkPhase([2], [5], [0, 60, 120, 180], $tr_planet, 1))
                    {
                        $level = 2;
                    } elseif ($level < 2 && checkPhase([2], [5], [0, 60, 120, 180], $tr_planet, 2))
                    {
                        $level = 1;
                    }
                }
                if ((checkPhase([1], [3], [0, 60, 120, 180], $tr_planet) && checkPhase([4], [3], [0, 60, 120, 180], $tr_planet)))
                {
                    if (checkPhase([4], [3], [0, 60, 120, 180], $tr_planet, 1))
                    {
                        $level = 2;
                    } elseif ($level < 2 && checkPhase([4], [3], [0, 60, 120, 180], $tr_planet, 2))
                    {
                        $level = 1;
                    }
                }
                if ((checkPhase([1], [5], [0, 60, 120, 180], $tr_planet) && checkPhase([4], [5], [0, 60, 120, 180], $tr_planet)))
                {
                    if (checkPhase([4], [5], [0, 60, 120, 180], $tr_planet, 1))
                    {
                        $level = 2;
                    } elseif ($level < 2 && checkPhase([4], [5], [0, 60, 120, 180], $tr_planet, 2))
                    {
                        $level = 1;
                    }
                }
                if ($level > 0 && !checkPhase([1], [4, 6, 8, 9], [0, 90, 180], $tp_planet))
                {
                    $level++;
                }
            }
            if (checkPhase([0], [4, 6], [90, 180], $tr_planet) || ($levels[3] >= 5 || $levels[4] >= 5))
            {
                $level--;
            }

            if ($level > 0)
            {
                $result[] = [
                    'name' => $day_kuaile,
                    'star_level' => $level,
                    'tips' => $day_kuaile_des,
                    'icon_url' => $icon_url1,
                    'tips_url' => $icon_url1_pop
                ];
            }
        }

        //激情之日
        //	tp木火成非刑相且月亮与火星或木星或金星成非刑相，或，tp金火合拱六分且月亮与金星或火星成非刑相，或，tp日火合拱六分且日金或金木成相且月亮与金或火合拱六分
        //		tr金过轴，或金与本命日月金火木成非刑相，或日水与本命金火成非刑相，或tr火过轴/火与本命日月金火木命主成合拱六分 同时天象日月水金之一与火合（以上相位同时出现两个以上则为2星，一个且容许度0.5内则为1星）
        //	天象金火1度内合并同时本命日月金之一合相
        //		1度内1星
        //	这段时间很容易被点燃欲望，感受到男女之爱的召唤。只要你愿意，你就会散发无限魅力。然而不一定是男欢女爱，做任何事情，你都可以激情满满，尤其是锻炼身体和人际往来方面。
        $level = 0;
        if (
            (checkPhase([5], [4], [0, 60, 120, 180], $tp_planet) && checkPhase([1], [3, 4, 5], [0, 60, 120, 180], $tp_planet))
            || (checkPhase([3], [4], [0, 60, 120], $tp_planet) && checkPhase([1], [3, 4], [0, 60, 120, 180], $tp_planet))
            || (checkPhase([0], [4], [0, 60, 120], $tp_planet) && checkPhase([3], [0, 5], [], $tp_planet)
                && checkPhase([1], [3, 4], [0, 60, 120], $tp_planet))
        )
        {
            $phase_num = 0;
            if (checkPhase([3], [ASC, MC], [0, 180], $tr_planet, 1)) $phase_num++;
            if (checkPhase([3], [0, 1, 3, 4, 5], [0, 60, 120, 180], $tr_planet)) $phase_num++;
            if (checkPhase([0, 2], [3, 4], [0, 60, 120, 180], $tr_planet)) $phase_num++;
            if (checkPhase([4], [ASC, MC], [0, 180], $tr_planet, 1)) $phase_num++;
            if (checkPhase([4], [0, 1, 3, 4, 5, $planet_mingzhu], [0, 60, 120], $tr_planet)
                && checkPhase([0, 1, 2, 3], [4], [0], $tx_planet)) $phase_num++;
            if ($phase_num > 2)
            {
                $level = 2;
            } elseif ($phase_num == 1
                && (checkPhase([3], [ASC, MC], [0, 180], $tr_planet, 0.5)
                    || checkPhase([3], [0, 1, 3, 4, 5], [0, 60, 120, 180], $tr_planet, 0.5)
                    || checkPhase([0, 2], [3, 4], [0, 60, 120, 180], $tr_planet, 0.5)
                    || checkPhase([4], [ASC, MC], [0, 180], $tr_planet, 0.5)
                    || checkPhase([4], [0, 1, 3, 4, 5], [0, 60, 120], $tr_planet, 0.5)
                ))
            {
                $level = 1;
            }
        }
        if ($level)
        {
            $result[] = [
                'name' => $day_jiqing,
                'star_level' => $level,
                'tips' => $day_jiqing_des,
                'icon_url' => $icon_url1,
                'tips_url' => $icon_url1_pop
            ];
        } elseif (!$level && checkPhase([3], [4], [0], $tx_planet, 1)
            && checkPhase([3, 4], [0, 1, 3], [0], $tr_planet, 1))
        {
            $level = 1;
            $result[] = [
                'name' => $day_jiqing,
                'star_level' => $level,
                'tips' => $day_jiqing_des,
                'icon_url' => $icon_url1,
                'tips_url' => $icon_url1_pop
            ];
        }

        //愉悦之日 20181010
        // tr日金水与本命日金水月成非刑相两组以上，且有一组必须有金星参与，【且有一组非冲】；同时，tr不会出现以下情形：
        //   1、tr火星0.6度内与本命日月水火【成相位】，
        //   2、tr火星在8/12宫与本命日月水火成相，
        //   3、tr太阳合刑冲火土
        //   4、愤怒或郁闷高于5
        // 1星，若金星相位等于多于两个则+1星，若此时tp月亮与金星成相+1星
        // 小小的开心，小小的喜悦，也许只是别人的一句话，也许只是一个烂漫的笑容，也许说不清道不明是为什么，但如果每天都沉浸在这小小的甜蜜里，生活一定充满了意义。
        if (!checkPhase([4], [0, 1, 2, 4], [], $tr_planet, 0.6)
            && (!checkSignHouse([4], [8, 12], $tr_planet)
                || !checkPhase([4], [0, 1, 2, 4], [], $tr_planet))
            && !checkPhase([0], [4, 6], [0, 90, 180], $tr_planet)
            && $levels[3] < 5 && $levels[4] < 5
        )
        {
            $level = 0;
            $tr_phase_num = 0;// 非刑相相位组数
            $tr_3_phase_num = 0;// 金星参与相位组数
            $tr_phase_no180_num = 0;// 非冲相位组数
            for ($i = 0; $i <= 3; $i++)
            {
                if ($i == 1) continue;// tr日金水
                for ($j = 0; $j <= 3; $j++)
                {
                    if (isset($tr_planet[$i]['phase'][$i . '-' . $j]))
                    {
                        // 非刑相
                        if ($tr_planet[$i]['phase'][$i . '-' . $j]['phase_e'] != 90)
                        {
                            $tr_phase_num++;
                        }
                        // 非冲相
                        if ($tr_planet[$i]['phase'][$i . '-' . $j]['phase_e'] != 180)
                        {
                            $tr_phase_no180_num++;
                        }
                        // 有金星参与
                        if ($i == 3 || $j == 3)
                        {
                            $tr_3_phase_num++;
                        }
                    }
                }
            }
            if ($tr_phase_num >= 2 && $tr_phase_no180_num >= 1 && $tr_3_phase_num > 0)
            {
                $level = 1;
                if ($tr_3_phase_num >= 2)
                {
                    $level++;
                }
                if (checkPhase([1], [3], [], $tp_planet))
                {
                    $level++;
                }
            }
            if ($level)
            {
                $result[] = [
                    'name' => $day_yuyue,
                    'star_level' => $level,
                    'tips' => $day_yuyue_des,
                    'icon_url' => $icon_url1,
                    'tips_url' => $icon_url1_pop
                ];
            }
        }

        //苏醒之日
        //	tr太阳合上升（0.5度内2星，1.5度内1星，木金水月之一也合上升+1星）
        //	tr太阳拱上升或tr太阳拱六分太阳或太阳合拱六分水星，同时tr水星过四轴或与本命日金水木合拱六分，同时本命水星无tr海王相位（tr太阳相位+水星相位容许度和小于1.5度1星）
        //	tp月亮与太阳成合拱六分，tr太阳与太阳合拱六分（小于1度1星）
        //	无论是心情低落还是健康低迷，今天都会回暖。或许你会得到一些新的消息，新的启发，新的鼓励，让你能感受到世界的光明和美好，就像从沉睡中苏醒，睁开眼睛。你将重新踏上旅途。这一天适合整理计划，规划未来。
        $level = 0;
        if (checkPhase([0], [ASC], [0], $tr_planet, 0.5))
        {
            $level = 2;
        } elseif (checkPhase([0], [ASC], [0], $tr_planet, 1.5))
        {
            $level = 1;
        }
        if ($level && checkPhase([1, 2, 3, 5], [ASC], [0], $tr_planet))
        {
            $level++;
        }
        $cond1 = false;// 太阳拱上升
        $cond2 = false;// 太阳拱六分太阳
        $cond3 = false;// 太阳合拱六分水星
        $cond4 = false;// 水星过四轴
        $cond5 = false;// 水星与本命日金水木合拱六分
        $cond6 = false;// 本命水星无tr海王相位
        $orb_0_min = 20;// 符合条件太阳相位的最小容许度
        $orb_2_min = 20;// 符合条件的水星相位的最小容许度
        if (!empty($tr_planet[0]['phase']))
        {
            foreach ($tr_planet[0]['phase'] as $phase)
            {
                if ($phase['id'] == ASC && $phase['phase_e'] == 120)
                {
                    $cond1 = true;
                    if ($phase['phase_orb'] < $orb_0_min) $orb_0_min = $phase['phase_orb'];
                }
                if ($phase['id'] == 0 && in_array($phase['phase_e'], [60, 120]))
                {
                    $cond2 = true;
                    if ($phase['phase_orb'] < $orb_0_min) $orb_0_min = $phase['phase_orb'];
                }
                if ($phase['id'] == 2 && in_array($phase['phase_e'], [0, 60, 120]))
                {
                    $cond3 = true;
                    if ($phase['phase_orb'] < $orb_0_min) $orb_0_min = $phase['phase_orb'];
                }
            }
        }
        if (!empty($tr_planet[2]['phase']))
        {
            foreach ($tr_planet[2]['phase'] as $phase)
            {
                if (in_array($phase['id'], [ASC, MC]) && in_array($phase['phase_e'], [0, 180]))
                {
                    $cond4 = true;
                    if ($phase['phase_orb'] < $orb_2_min) $orb_2_min = $phase['phase_orb'];
                }
                if (in_array($phase['id'], [0, 2, 3, 5]) && in_array($phase['phase_e'], [0, 60, 120]))
                {
                    $cond5 = true;
                    if ($phase['phase_orb'] < $orb_2_min) $orb_2_min = $phase['phase_orb'];
                }
            }
        }
        if (!isset($tr_planet[8]['phase']['8-2'])) $cond6 = true;

        if (!$level && ($cond1 || $cond2 || $cond3) && ($cond4 || $cond5) && $cond6)
        {
            if ($orb_0_min + $orb_2_min < 1.5)
            {
                $level = 1;
            }
        }
        if (!$level && checkPhase([1], [0], [0, 60, 120], $tp_planet)
            && checkPhase([0], [0], [0, 60, 120], $tr_planet, 1))
        {
            $level = 1;
        }
        if ($level)
        {
            $result[] = [
                'name' => $day_suxing,
                'star_level' => $level,
                'tips' => $day_suxing_des,
                'icon_url' => $icon_url2,
                'tips_url' => $icon_url2_pop
            ];
        }

        //奇迹之日
        //	tp日木天成相且月亮与金木之一成非刑相，同时tr木星与本命日月金之一成非刑相
        //		tr日月金水火之二与本命木星成相，或，tr日金水火之一与木星成相且另一与本命天王成非刑相，或tr日金水火之二合10宫与本命日金木之一成非刑相（tr火星参与为2星，否则3星）
        //	tp日木天成相且月亮与金木之一成非刑相
        //		tr日月金水火之二与本命木星成相，或，tr日金水火之一与木星成相且另一与本命天王成非刑相，或tr日金水火之二合10宫与本命日金木之一成非刑相（tr火星参与为1星，否则2星）
        //	tp日天成相且月亮与金木之一成非刑相
        //		tr日月金水火之二与本命木星成非刑相，或，tr日金水火之一与木星成相且另一与本命天王成非刑相，或tr日金水火之二合10宫与本命日金木之一成非刑相（满足基本条件为1星，每多两个非刑相+1星）
        //	在你最想改变和突破时，机遇会悄然来到你面前。这很可能是扭转你人生的契机，为你创造奇迹。然而对没有做好准备的人而言，却很可能只是烟花一场，什么都不会发生。如果你的转变已经开始了，这仍然是个值得期待的美好日子。
        $level = 0;
        $tr01234_phase5_num = 0;
        $tr0234__house10_phase035_no90_num = 0;
        $is_tr0234_phase5_phase7_no90 = false;
        $is_4_phase_1 = false;// 条件1火星是否参与
        $is_4_phase_2 = false;// 条件2火星是否参与
        $is_4_phase_3 = false;// 条件3火星是否参与
        $tr_phase_no90_1_num = 0;
        $tr_phase_no90_2_num = 0;
        // 日月水金火
        for ($i = 0; $i < 5; $i++)
        {
            // 日金木天
            foreach ([0, 3, 5, 7] as $j)
            {
                if (in_array($i, [0, 1, 2, 3, 4]) && $j == 5
                    && isset($tr_planet[$i]['phase'][$i . '-' . $j]))
                {
                    $tr01234_phase5_num++;
                    if ($i == 4 || $j == 4) $is_4_phase_1 = true;
                    if ($tr_planet[$i]['phase'][$i . '-' . $j]['phase_e'] != 90) $tr_phase_no90_1_num++;
                }
                if (in_array($i, [0, 2, 3, 4]) && $tr_planet[$i]['in_house_id'] == 10
                    && in_array($j, [0, 3, 5]) && isset($tr_planet[$i]['phase'][$i . '-' . $j])
                    && $tr_planet[$i]['phase'][$i . '-' . $j]['phase_e'] != 90)
                {
                    $tr0234__house10_phase035_no90_num++;
                    if ($i == 4 || $j == 4) $is_4_phase_2 = true;
                }
            }
        }
        $tr_phase_no90_3_num = $tr0234__house10_phase035_no90_num;

        if (checkPhase([0], [5], [], $tr_planet) && checkPhase([2, 3, 4], [7], [0, 60, 120, 180], $tr_planet))
        {
            $is_tr0234_phase5_phase7_no90 = true;
            if (checkPhase([4], [7], [0, 60, 120, 180], $tr_planet))
            {
                $is_4_phase_3 = true;
            }
        }
        if (checkPhase([2], [5], [], $tr_planet) && checkPhase([0, 3, 4], [7], [0, 60, 120, 180], $tr_planet))
        {
            $is_tr0234_phase5_phase7_no90 = true;
            if (checkPhase([4], [7], [0, 60, 120, 180], $tr_planet))
            {
                $is_4_phase_3 = true;
            }
        }
        if (checkPhase([3], [5], [], $tr_planet) && checkPhase([2, 0, 4], [7], [0, 60, 120, 180], $tr_planet))
        {
            $is_tr0234_phase5_phase7_no90 = true;
            if (checkPhase([4], [7], [0, 60, 120, 180], $tr_planet))
            {
                $is_4_phase_3 = true;
            }
        }
        if (checkPhase([4], [5], [], $tr_planet) && checkPhase([0, 2, 3], [7], [0, 60, 120, 180], $tr_planet))
        {
            $is_tr0234_phase5_phase7_no90 = true;
            $is_4_phase_3 = true;
        }

        if (checkPhase([0], [5], [0, 60, 120, 180], $tr_planet)) $tr_phase_no90_2_num++;
        if (checkPhase([2], [5], [0, 60, 120, 180], $tr_planet)) $tr_phase_no90_2_num++;
        if (checkPhase([3], [5], [0, 60, 120, 180], $tr_planet)) $tr_phase_no90_2_num++;
        if (checkPhase([4], [5], [0, 60, 120, 180], $tr_planet)) $tr_phase_no90_2_num++;

        if (checkPhase([0], [7], [0, 60, 120, 180], $tr_planet)) $tr_phase_no90_2_num++;
        if (checkPhase([2], [7], [0, 60, 120, 180], $tr_planet)) $tr_phase_no90_2_num++;
        if (checkPhase([3], [7], [0, 60, 120, 180], $tr_planet)) $tr_phase_no90_2_num++;
        if (checkPhase([4], [7], [0, 60, 120, 180], $tr_planet)) $tr_phase_no90_2_num++;

        // 月天非刑相
        if (checkPhase([1], [3, 5], [0, 60, 120, 180], $tp_planet))
        {
            // 日天
            if (checkPhase([0], [7], [], $tp_planet))
            {
                // 日木
                if (checkPhase([0], [5], [], $tp_planet))
                {
                    if (!$level && $tr01234_phase5_num >= 2)
                    {
                        // 木与日月金非刑
                        if (checkPhase([5], [0, 1, 3], [0, 60, 120, 180], $tr_planet))
                        {
                            if ($is_4_phase_1) $level = 2; else $level = 3;
                        } else
                        {
                            if ($is_4_phase_1) $level = 1; else $level = 2;
                        }
                    }
                    if (!$level && $is_tr0234_phase5_phase7_no90)
                    {
                        if (checkPhase([5], [0, 1, 3], [0, 60, 120, 180], $tr_planet))
                        {
                            if ($is_4_phase_2) $level = 2; else $level = 3;
                        } else
                        {
                            if ($is_4_phase_2) $level = 1; else $level = 2;
                        }

                    }
                    if (!$level && $tr0234__house10_phase035_no90_num >= 2)
                    {
                        if (checkPhase([5], [0, 1, 3], [0, 60, 120, 180], $tr_planet))
                        {
                            if ($is_4_phase_3) $level = 2; else $level = 3;
                        } else
                        {
                            if ($is_4_phase_3) $level = 1; else $level = 2;
                        }
                    }
                }
                if ($level < 3)
                {
                    if ($tr01234_phase5_num >= 2 && $tr_phase_no90_1_num >= 2)
                    {
                        $level += 1 + floor(($tr_phase_no90_1_num - 2) / 2);
                    }
                    if ($level < 3 && $is_tr0234_phase5_phase7_no90)
                    {
                        $level += 1 + floor(($tr_phase_no90_2_num - 2) / 2);
                    }
                    if ($level < 3 && $tr0234__house10_phase035_no90_num >= 2)
                    {
                        $level += 1 + floor(($tr_phase_no90_3_num - 2) / 2);
                    }
                    if ($level > 3) $level = 3;
                }
            }
        }

        if ($level)
        {
            $result[] = [
                'name' => $day_qiji,
                'star_level' => $level,
                'tips' => $day_qiji_des,
                'icon_url' => $icon_url2,
                'tips_url' => $icon_url2_pop
            ];
        }

        //启迪之日
        //	tr太阳合拱六分木星，同时本命3/9宫内日月金水与tr日金水成非刑相。（没有tr火星在1度内合刑冲日月水）
        //		日木1度内2星，否则1星，如同时有金水成相或水木或水金非刑相+1星
        //	tp月亮与木星成非刑相，且tr日金水火之二落在3或9宫，且本命木星与tr日金水之一成相
        //		1星
        //	你心情放松，新的机遇或新的心灵启示会随之到来。你会发现你在拓展，心灵上的拓展，或者事业上的拓展，或是放开眼界，或是结识新交，或是收获钱财。
        $level = 0;
        if (checkPhase([0], [5], [0, 60, 120], $tr_planet)
            && !checkPhase([4], [0, 1, 2], [0, 90, 180], $tr_planet, 1)
            &&
            (
                (in_array($na_planet[0]['in_house_id'], [3, 9]) && checkPhase([0, 2, 3], [0], [0, 60, 120, 180], $tr_planet))
                || (in_array($na_planet[1]['in_house_id'], [3, 9]) && checkPhase([0, 2, 3], [1], [0, 60, 120, 180], $tr_planet))
                || (in_array($na_planet[2]['in_house_id'], [3, 9]) && checkPhase([0, 2, 3], [2], [0, 60, 120, 180], $tr_planet))
                || (in_array($na_planet[3]['in_house_id'], [3, 9]) && checkPhase([0, 2, 3], [3], [0, 60, 120, 180], $tr_planet))
            )
        )
        {
            if (checkPhase([0], [5], [], $tr_planet, 1)) $level = 2; else $level = 1;

            if (checkPhase([3], [2], [0, 60, 120, 180], $tr_planet)
                || checkPhase([2], [5], [0, 60, 120, 180], $tr_planet)
                || checkPhase([2], [3], [0, 60, 120, 180], $tr_planet))
            {
                $level += 1;
            }
        }
        if (!$level && checkPhase([1], [5], [0, 60, 120, 180], $tp_planet) && checkPhase([4], [0, 1, 2], [0, 90, 120], $tr_planet, 1))
        {
            $tr0234_house39_num = 0;
            if (checkSignHouse([0], [3, 9], $tr_planet)) $tr0234_house39_num++;
            if (checkSignHouse([2], [3, 9], $tr_planet)) $tr0234_house39_num++;
            if (checkSignHouse([3], [3, 9], $tr_planet)) $tr0234_house39_num++;
            if (checkSignHouse([4], [3, 9], $tr_planet)) $tr0234_house39_num++;
            if ($tr0234_house39_num >= 2)
            {
                $level = 1;
            }
        }

        if ($level)
        {
            $result[] = [
                'name' => $day_qidi,
                'star_level' => $level,
                'tips' => $day_qidi_des,
                'icon_url' => $icon_url2,
                'tips_url' => $icon_url2_pop
            ];
        }


        //收获之日
        //	tr木星与金星成相，且tr金星与本命日月金合拱六分，且tr金木之一在10宫
        //		tr金星相位1度内1星，若此时本命金星与tr太阳成非刑相则+1星
        //	tp金木成相，且月亮与金木之一成相或月亮与10宫星体合拱六分，且tr 金与本命日月金水木/ 日与本命日金木/ 水与本命金木至少满足两组非刑相
        //		tr满足三组3星，满足两组且容许度之和小于1.5则2星，否则1星  (容许度取满足的组最紧密相位容许度之和)
        //	你有机会看到好的成果，在付出努力并等待一段时间之后，这是一个预示收获的时间，会有喜事发生。但倘若你没有付出努力，大概也只是玩得比较开心罢了。祝愿你有不劳而获的好运气。
        $level = 0;
        if (checkPhase([5], [3], [], $tr_planet) && checkPhase([3], [0, 1, 3], [0, 60, 120], $tr_planet) && checkSignHouse([3, 5], [10], $tr_planet))
        {
            if (checkPhase([3], [0, 1, 3], [0, 60, 120], $tr_planet, 1))
            {
                $level = 1;
                if (checkPhase([0], [3], [0, 60, 120, 180], $tr_planet))
                {
                    $level = 2;
                }
            }
        }
        $is_tp1_phase_house10 = false;
        if (!empty($tp_planet[1]['phase']))
        {
            foreach ($tp_planet[1]['phase'] as $phase)
            {
                if (in_array($phase['phase_e'], [0, 60, 120]) && $tp_planet[$phase['id']]['in_house_id'] == 10)
                {
                    $is_tp1_phase_house10 = true;
                }
            }
        }
        $num = 0;
        if (checkPhase([3], [0, 1, 2, 3, 5], [0, 60, 120, 180], $tr_planet)) $num++;
        if (checkPhase([0], [0, 3, 5], [0, 60, 120, 180], $tr_planet)) $num++;
        if (checkPhase([2], [3, 5], [0, 60, 120, 180], $tr_planet)) $num++;
        if (checkPhase([3], [5], [], $tp_planet) && checkPhase([1], [3, 5], [], $tp_planet) && $is_tp1_phase_house10 && $num >= 2)
        {
            $sum = 0;
            foreach ([0, 2, 3] as $i)
            {
                $min = 100;
                foreach ([0, 1, 2, 3, 5] as $j)
                {
                    if (isset($tr_planet[$i]['phase'][$i . '-' . $j])
                        && in_array($tr_planet[$i]['phase'][$i . '-' . $j]['phase_e'], [0, 60, 120, 180]))
                    {
                        if ((($i == 0 && in_array($j, [0, 3, 5]))
                                || ($i == 2 && in_array($j, [3, 5]))
                                || ($i == 3 && in_array($j, [0, 1, 2, 3, 5])))
                            && $tr_planet[$i]['phase'][$i . '-' . $j]['phase_orb'] < $min)
                        {
                            $min = $tr_planet[$i]['phase'][$i . '-' . $j]['phase_orb'];
                        }
                    }
                }
                if ($min != 100) $sum += $min;
            }
            if ($num === 3)
            {
                $level = 3;
            } elseif ($level < 2 && $num === 2 && $sum <= 1.5)
            {
                $level = 2;
            } elseif (!$level)
            {
                $level = 1;
            }
        }

        if ($level)
        {
            $result[] = [
                'name' => $day_shouhuo,
                'star_level' => $level,
                'tips' => $day_shouhuo_des,
                'icon_url' => $icon_url2,
                'tips_url' => $icon_url2_pop
            ];
        }

        //超越之日 20180906
        // tp金木成相，且月亮与金木之一成相或月亮与10宫星体合拱六分，且月亮不刑火土，且月亮不在6/8/12宫，且tr太阳与10宫日月金木合拱六分或太阳在10宫与日月金木合拱六分
        //  tr太阳最紧密相位30分内3星，1度内2星，其余3星
        // 这一天非常有利于事业和名声，或许会有超出预期的好运气出现，至少你会有所收获，将会感到快乐和满足。近期你都可以积极推进事业发展、朋友合作，是一段难得的好时光。
        // 20180911 新增条件
        // tp日木成相，且月亮在5/7/9/10/11宫与木天同时成非刑相或与天王成合拱六分（此时月亮不与土冥合刑冲）
        // 以下判断条件分别计算，一条成立即可，如多条同时成立为3星：
        // tr日金水火木三颗或以上与10宫宫内星合拱六分【2星】
        // tr日金水火三颗以上与9/11宫的日月金水合拱六分【1星】
        // 当日有日月食，且tr太阳与金木天之一成相【1星】
        $level = 0;
        $is_moonphase060120_house10 = false;
        if (!empty($tp_planet[1]['phase']))
        {
            foreach ($tp_planet[1]['phase'] as $phase)
            {
                if ($tp_planet[$phase['id']]['in_house_id'] == 10)
                {
                    $is_moonphase060120_house10 = true;
                }
            }
        }
        $cond = false;
        $min_orb = 30;// tr太阳最紧密相位，实际容许度
        if (!empty($tr_planet[0]['phase']))
        {
            foreach ($tr_planet[0]['phase'] as $phase)
            {
                if (in_array($phase['phase_e'], [0, 60, 120]) && in_array($phase['id'], [0, 1, 3, 5])
                    && ($na_planet[$phase['id']]['in_house_id'] == 10 || ($tr_planet[0]['in_house_id'] == 10))
                )
                {
                    $cond = true;
                    if ($phase['phase_orb'] < $min_orb)
                    {
                        $min_orb = $phase['phase_orb'];
                    }
                }
            }
        }
        if (checkPhase([3], [5], [], $tp_planet)
            && (checkPhase([1], [3, 5], [], $tp_planet) && $is_moonphase060120_house10)
            && !checkPhase([1], [4, 6], [90], $tp_planet)
            && !checkSignHouse([1], [6, 8, 12], $tp_planet)
            && $cond
        )
        {
            if ($min_orb < 0.5)
            {
                $level = 3;
            } elseif ($min_orb < 1)
            {
                $level = 2;
            } else
            {
                $level = 1;
            }

        }
        if (checkPhase([0], [5], [], $tp_planet) && checkSignHouse([1], [5, 7, 9, 10, 11], $tp_planet)
            &&
            (
                (checkPhase([1], [5], [0, 60, 120, 180], $tp_planet) && checkPhase([1], [7], [0, 60, 120, 180], $tp_planet))
                || checkPhase([1], [7], [0, 60, 120], $tp_planet)
            )
            && !checkPhase([1], [6, 9], [0, 90, 180], $tp_planet)
        )
        {
            $cond2_1 = 0;
            $cond2_2 = 0;
            $cond2_3 = false;
            $count = 0;
            foreach ([0, 2, 3, 4, 5] as $i)
            {
                if (!empty($tr_planet[$i]['phase']))
                {
                    $i_1 = false;
                    $i_2 = false;
                    foreach ($tr_planet[$i]['phase'] as $phase)
                    {

                        if ($i_1 === false && in_array($phase['phase_e'], [0, 60, 120]))
                        {
                            if ($na_planet[$phase['id']]['in_house_id'] == 10)
                            {
//                                $i_1 = true;
                                $cond2_1++;
                                break;
                            }
                            if ($i != 5 && $i_2 === false && in_array($na_planet[$phase['id']]['in_house_id'], [9, 11]) && in_array($phase['id'], [0, 1, 2, 3]))
                            {
//                                $i_2 = true;
                                $cond2_2++;
                                break;
                            }
                        }
                    }
                }
            }

            if (($this->solarEclipse !== false || $this->lunarEclipse !== false) && checkPhase([0], [3, 5, 7], [], $tr_planet))
            {
                $cond2_3 = true;
            }
            if ($cond2_1 >= 3) $count++;
            if ($cond2_2 >= 3) $count++;
            if ($cond2_3) $count++;
            if ($level < 3 && $count > 1)
            {
                $level = 3;
            } elseif ($level < 2 && $cond2_1 >= 3)
            {
                $level = 2;
            } elseif ($level <= 0 && ($cond2_2 >= 3 || $cond2_3))
            {
                $level = 1;
            }
        }
        if ($level)
        {
            $result[] = [
                'name' => $day_chaoyue,
                'star_level' => $level,
                'tips' => $day_chaoyue_des,
                'icon_url' => $icon_url2,
                'tips_url' => $icon_url2_pop
            ];
        }

        //变化之日 20180911 词条修改
        //	tp月亮6/10宫与天王成相，或，tp天王6/10宫与月亮成相，或，月亮与天王刑冲，或，tp天王6宫同时月亮参与闭合三角且有刑冲相位，或，tp月亮与木天海同时成相
        //		tr日金水火之二与本命天王成相，或，tr日月金水火之二冲6/10宫星体【1星】
        //		tr日水金火与本命日月水金火成相两组以上【2组1星，3组2星，4组3星】
        //	此时常会发生工作变动，或你对当前境遇不满，想要做出改变。俗话说“树挪死人挪活”，困境之中，我们需抓住每一个转机，只是一定要想清楚，是不是真的到了必须改变的时候。
        // 此时常会发生工作变动，或你对当前境遇不满，想要做出改变。如果你在困境之中，理应抓住每一个转机，只是一定要想清楚，是不是真的到了必须改变的时候，改变后能否保证比现在更好。如果你只是遇到了一点小挫折，建议你还是安心工作。人生没有完美，努力就会苦尽甘来。
        $level = 0;
        $is_1phase90180 = false;
        if (!empty($tp_planet[1]['phase']))
        {
            foreach ($tp_planet[1]['phase'] as $phase)
            {
                if (in_array($phase['phase_e'], [90, 180]))
                {
                    $is_1phase90180 = true;
                }
            }
        }
        if ((checkSignHouse([1], [6, 10], $tp_planet) && checkPhase([1], [7], [], $tp_planet))
            || (checkSignHouse([7], [6, 10], $tp_planet) && checkPhase([7], [1], [], $tp_planet))
            || checkPhase([1], [7], [90, 180], $tp_planet)
            || (checkSignHouse([7], [6], $tp_planet) && $is_1phase90180
                && ($is_moon_in_trine || $is_moon_in_small_triangle || $is_moon_in_t_square || $is_moon_in_bridge_triangle))
        )
        {
            $tr0234_phase01234_num = 0;
            $tr0234_phase7_num = 0;
            foreach ([0, 2, 3, 4] as $i)
            {
                foreach ([0, 1, 2, 3, 4] as $j)
                {
                    if (isset($tr_planet[$i]['phase'][$i . '-' . $j]))
                    {
                        $tr0234_phase01234_num++;
                    }
                }
                if (checkPhase([$i], [7], [], $tr_planet))
                {
                    $tr0234_phase7_num++;
                }
            }
            $tr_01234_phase180_house610_num = 0;

            foreach ([0, 1, 2, 3, 4] as $k)
            {
                if (!empty($tr_planet[$k]['phase']))
                {
                    foreach ($tr_planet[$k]['phase'] as $phase)
                    {
                        if ($phase['phase_e'] == 180 && in_array($na_planet[$phase['id']]['in_house_id'], [6, 10]))
                        {
                            $tr_01234_phase180_house610_num++;
                        }
                    }
                }
            }

            if ($tr0234_phase01234_num >= 4)
            {
                $level = 3;
            } elseif ($tr0234_phase01234_num >= 3)
            {
                $level = 2;
            } else
            {
                if ($tr0234_phase01234_num == 2
                    || $tr0234_phase7_num >= 2
                    || $tr_01234_phase180_house610_num >= 2
                )
                {
                    $level = 1;
                }
            }

        }

        if ($level)
        {
            $result[] = [
                'name' => $day_bianhua,
                'star_level' => $level,
//                'tips' => '此时常会发生工作变动，或你对当前境遇不满，想要做出改变。如果你在困境之中，理应抓住每一个转机，只是一定要想清楚，是不是真的到了必须改变的时候，改变后能否保证比现在更好。如果你只是遇到了一点小挫折，建议你还是安心工作。人生没有完美，努力就会苦尽甘来。',
                'tips' => $day_bianhua_des,
                'icon_url' => $icon_url3,
                'tips_url' => $icon_url3_pop
            ];
        }

        //奔走之日 修改中括号部分 20180905
        // tp月亮3/9宫与   水木火或9/11宫星体成相，或，tp月亮与水星金星同时成相，或，tp月亮与水星木星同时成相，或，水木成相且月亮与水木之一成相同时与火金天之一成相
        //  tr水星与本命日月金水火成相，
        //  或tr日月金水火之二与本命水星成相，
        //  或tr日月金水【去掉了火】之二在3/9宫与本命星体成相【加条件，其中一颗本命星为日月金水】，
        //  或tr日月水金火两颗以上在3宫且一颗与3宫宫内星或本命日月水金火冲拱六分，
        //  或tr金星过轴或与本命日月金水合冲
        //  （若条件只含一个相位，该相位容许度小于1则为2星，否则1星；
        //   若条件含两个相位，两个最紧密相位的容许度合小于2为2星，否则1星；
        //   同时满足两个以上条件者+1星）
        // 你会有一些走动机会，无论旅行还是出差，还是因繁杂事务奔忙往来。久违的朋友也可能有了消息，前来探望或者向你发送邀请。你的心也可能比平时更不安分，渴望见到更广阔的天空。【不过对某些人而言，可能会选择交流学习、阅读思考，接收一些新的信息，让自己的大脑和心灵踏上旅程。】
        $level = 0;
        $cond1 = false;
        if (!empty($tp_planet[1]['phase']) && checkSignHouse([1], [3, 9], $tp_planet))
        {
            foreach ($tp_planet[1]['phase'] as $phase)
            {
                // tp月亮3/9宫与水木火 或9/11宫星体成相
                if (in_array($phase['id'], [2, 4, 5]) || checkSignHouse([$phase['id']], [9, 11], $tp_planet))
                {
                    $cond1 = true;
                }
            }
        }
        if (
            $cond1 || (checkPhase([1], [3, 5], [], $tp_planet)
                && (checkPhase([1], [2], [], $tp_planet)
                    || (checkPhase([2], [5], [], $tp_planet) && checkPhase([1], [3, 4, 7], [], $tp_planet)))))
        {
            $cond2_1 = [];// tr水星与本命日月金水火成相
            $cond2_2 = [];// 或tr日月金水火之二与本命水星成相
            $cond2_3 = [];//tr日月金水【去掉了火】之二在3/9宫与本命星体成相
            $cond2_3_2 = false;// 加条件，其中一颗本命星为日月金水
            $cond2_4_1 = 0;// 在3宫
            $cond2_4_2 = 0;// 与3宫宫内星或本命日月水金火冲拱六分
            $cond2_4_3 = [];
            $cond2_5 = [];
            // tr日月水金火
            foreach ([0, 1, 2, 3, 4] as $i)
            {
                if (!empty($tr_planet[$i]['phase']))
                {
                    foreach ($tr_planet[$i]['phase'] as $phase)
                    {
                        if ($i == 2 && in_array($phase['id'], [0, 1, 2, 3, 4]))
                        {
                            if (!isset($cond2_1[$phase['phase_e']]) || $phase['phase_orb'] < $cond2_1[$phase['phase_e']])
                            {
                                $cond2_1[$phase['phase_e']] = $phase['phase_orb'];
                            }
                        }
                        if ($phase['id'] == 2)
                        {
                            if (!isset($cond2_2[$phase['phase_e']]) || $phase['phase_orb'] < $cond2_2[$phase['phase_e']])
                            {
                                $cond2_2[$phase['phase_e']] = $phase['phase_orb'];
                            }
                        }
                        if (in_array($tr_planet[$phase['id']]['in_house_id'], [3, 9]))
                        {
                            if (!isset($cond2_3[$phase['phase_e']]) || $phase['phase_orb'] < $cond2_3[$phase['phase_e']])
                            {
                                $cond2_3[$phase['phase_e']] = $phase['phase_orb'];
                            }
                        }
                        if (in_array($i, [0, 1, 2, 3]) && in_array($tr_planet[$i]['in_house_id'], [3, 9]))
                        {
                            if (!isset($cond2_3[$phase['phase_e']]) || $phase['phase_orb'] < $cond2_3[$phase['phase_e']])
                            {
                                $cond2_3[$phase['phase_e']] = $phase['phase_orb'];
                            }
                            if (in_array($phase['id'], [0, 1, 2, 3]))
                            {
                                $cond2_3_2 = true;
                            }
                        }
                        if ($tr_planet[$phase['id']]['in_house_id'] == 3)
                        {
                            $cond2_4_1++;
                        }
                        if ($na_planet[$phase['id']]['in_house_id'] == 3
                            || (in_array($phase['id'], [0, 1, 2, 3, 4]) && in_array($phase['phase_e'], [60, 120, 180]))
                        )
                        {
                            if (!isset($cond2_4_3[$phase['phase_e']]) || $phase['phase_orb'] < $cond2_4_3[$phase['phase_e']])
                            {
                                $cond2_4_3[$phase['phase_e']] = $phase['phase_orb'];
                            }
                            $cond2_4_2++;
                        }
                        if ($i == 3 && (checkPhase([3], [ASC, MC], [0, 180], $tr_planet, 1)
                                || (in_array($phase['id'], [0, 1, 2, 3]) && in_array($phase['phase_e'], [0, 180])))
                        )
                        {
                            if (!isset($cond2_5[$phase['phase_e']]) || $phase['phase_orb'] < $cond2_5[$phase['phase_e']])
                            {
                                $cond2_5[$phase['phase_e']] = $phase['phase_orb'];
                            }
                        }
                    }
                }
            }
            // 只涉及到一个相位
            if (count($cond2_1) == 1)
            {
                reset($cond2_1);
                $current = current($cond2_1);// 获取当前相位容许度
                if ($current < 1)
                {
                    $level = 2;
                } else
                {
                    $level = 1;
                }
            } // 涉及到两个相位
            elseif (count($cond2_1) >= 2)
            {
                $orbs = [];

                foreach ($cond2_1 as $ps) $orbs[] = $ps;

                sort($orbs);

                if ($orbs[0] + $orbs[1] < 2)
                {
                    $level = 2;
                } else
                {
                    $level = 1;
                }
            }
            // 计算 或tr日月金水火之二与本命水星成相，
            if ($level < 2 && count($cond2_2) >= 2)
            {
                $orbs = [];

                foreach ($cond2_2 as $ps) $orbs[] = $ps;

                sort($orbs);

                if ($orbs[0] + $orbs[1] < 2)
                {
                    $level = 2;
                } else
                {
                    $level = 1;
                }
            }
            if ($level < 2 && count($cond2_3) >= 2 && $cond2_3_2 === true)
            {
                $orbs = [];

                foreach ($cond2_3 as $ps) $orbs[] = $ps;

                sort($orbs);

                if ($orbs[0] + $orbs[1] < 2)
                {
                    $level = 2;
                } else
                {
                    $level = 1;
                }
            }
            if ($level < 2 && $cond2_4_1 >= 2 && $cond2_4_2 >= 1)
            {
                if (count($cond2_4_3) == 1)
                {
                    reset($cond2_4_3);
                    $current = current($cond2_4_3);// 获取当前相位容许度
                    if ($current < 1)
                    {
                        $level = 2;
                    } else
                    {
                        $level = 1;
                    }
                } else
                {
                    $orbs = [];

                    foreach ($cond2_4_3 as $ps) $orbs[] = $ps;

                    sort($orbs);

                    if ($orbs[0] + $orbs[1] < 2)
                    {
                        $level = 2;
                    } else
                    {
                        $level = 1;
                    }
                }
            }
            if ($level < 2 && count($cond2_5) >= 1)
            {
                // 只涉及到一个相位
                if (count($cond2_5) == 1)
                {
                    reset($cond2_5);
                    $current = current($cond2_5);// 获取当前相位容许度
                    if ($current < 1)
                    {
                        $level = 2;
                    } else
                    {
                        $level = 1;
                    }
                } // 涉及到两个相位
                elseif (count($cond2_5) >= 2)
                {
                    $orbs = [];

                    foreach ($cond2_5 as $ps) $orbs[] = $ps;

                    sort($orbs);

                    if ($orbs[0] + $orbs[1] < 2)
                    {
                        $level = 2;
                    } else
                    {
                        $level = 1;
                    }
                }
            }
            $true_num = 0;
            if ($cond2_1 >= 1) $true_num++;
            if (count($cond2_2) >= 2) $true_num++;
            if (count($cond2_3) >= 2) $true_num++;
            if ($cond2_4_1 >= 2 && $cond2_4_2 >= 1) $true_num++;
            if (count($cond2_5) >= 1) $true_num++;
            if ($true_num >= 2)
            {
                $level++;
            }
        }

        if ($level)
        {
            $result[] = [
                'name' => $day_benzou,
                'star_level' => $level,
                'tips' => $day_benzou_des,
                'icon_url' => $icon_url3,
                'tips_url' => $icon_url3_pop
            ];
        }


        //冲击之日
        //	tr日水金火月四颗以上与星盘星体对冲
        //		1星，若tp月亮与天王星成相，+1星，若太阳也与天王星合刑冲，+1星
        //	这是不太平静的一天，往往有突然的变化出现，不一定是好的还是不好的，但你会从枯燥生活中解脱出来，体验一些新的经历
        $level = 0;
        $cond1_num = 0;
        foreach ([0, 1, 2, 3, 4] as $i)
        {
            if (!empty($tr_planet[$i]['phase']))
            {
                foreach ($tr_planet[$i]['phase'] as $phase)
                {
                    if ($phase['phase_e'] == 180)
                    {
                        $cond1_num++;
                        continue;
                    }
                }
            }
        }
        if ($cond1_num >= 4)
        {
            $level = 1;
            if (checkPhase([1], [7], [], $tp_planet))
            {
                $level++;
                if (checkPhase([0], [7], [], $tp_planet))
                {
                    $level++;
                }
            }
        }

        if ($level)
        {
            $result[] = [
                'name' => $day_chongji,
                'star_level' => $level,
                'tips' => $day_chongji_des,
                'icon_url' => $icon_url3,
                'tips_url' => $icon_url3_pop
            ];
        }

        // 瘦身之日（仅对女盘有效） 健身之日（仅对男盘有效）
        //	tr火土在1/7宫，或，tr火土与本命日月成相，或tp月亮与火土成相，或tp太阳与火土成相
        //		tr火星合升降1度内
        //		tr火星合拱六分月亮
        //		tr日火合拱六分
        //		tr金火合拱六分
        //		tr水火合拱六分
        //		tr日土合拱六分
        //瘦身之日（仅对女盘有效）
        //	若本命日月金火上升两个以上位于金牛座或巨蟹座，3星
        //	若本命日月金火上升都不在金牛或巨蟹座，1星
        //	其余两星
        //	今天适合执行瘦身或锻炼计划，比以往会事半功倍，但一定要注意不要用力过猛，安全第一。不开心的事情，都可以在锻炼中遗忘，成功没有捷径，坚持才会胜利。

        //健身之日（仅对男盘有效）
        //	以上条件成立为1星
        //	若本日月命主之一在6宫，或6宫内星与日月命主之一成相+1星
        //	若本命火星合轴或与日月木之一成相，+1星
        //	今天适合执行锻炼计划，比以往会事半功倍，但一定要注意不要用力过猛，安全第一。不开心的事情，都可以在锻炼中遗忘，成功没有捷径，坚持才会胜利。
        if (checkSignHouse([4, 6], [1, 7], $tr_planet)
            || checkPhase([4, 6], [0, 1], [], $tr_planet)
            || checkPhase([1], [4, 6], [], $tp_planet)
            || checkPhase([0], [4, 6], [], $tp_planet)
        )
        {
            if (
                checkPhase([4], [ASC], [0, 180], $tr_planet, 1)
                || checkPhase([4], [1], [0, 60, 120], $tr_planet)
                || checkPhase([0, 2, 3], [4], [0, 60, 120], $tr_planet)
                || checkPhase([0], [6], [0, 60, 120], $tr_planet)
            )
            {
//                $level = 0;
                // 女盘 瘦身之日
                if ($this->sex == 2)
                {
                    $planet0134ASC_insign24_num = 0;

                    if (in_array($na_planet[0]['in_sign_id'], [2, 4])) $planet0134ASC_insign24_num++;
                    if (in_array($na_planet[1]['in_sign_id'], [2, 4])) $planet0134ASC_insign24_num++;
                    if (in_array($na_planet[3]['in_sign_id'], [2, 4])) $planet0134ASC_insign24_num++;
                    if (in_array($na_planet[4]['in_sign_id'], [2, 4])) $planet0134ASC_insign24_num++;
                    if (in_array($na_planet[ASC]['in_sign_id'], [2, 4])) $planet0134ASC_insign24_num++;

                    if ($planet0134ASC_insign24_num >= 2)
                    {
                        $level = 3;
                    } elseif ($planet0134ASC_insign24_num == 0)
                    {
                        $level = 1;
                    } else
                    {
                        $level = 2;
                    }

                    $result[] = [
                        'name' => $day_shoushen,
                        'star_level' => $level,
                        'tips' => $day_shoushen_des,
                        'icon_url' => $icon_url3,
                        'tips_url' => $icon_url3_pop
                    ];
                } // 男盘 健身之日
                elseif ($this->sex == 1)
                {
                    $level = 1;

                    $cond1 = false;

                    foreach ([0, 1, $planet_mingzhu] as $i)
                    {
                        if ($na_planet[$i]['in_house_id'] == 6) $cond1 = true;
                        if (!$cond1 && !empty($na_planet[$i]['phase']))
                        {
                            foreach ($na_planet[$i]['phase'] as $phase)
                            {
                                if (!$cond1 && $na_planet[$phase['id']]['in_house_id'] == 6)
                                {
                                    $cond1 = true;
                                }
                            }
                        }
                    }
                    if ($cond1) $level++;

                    if (checkPhase([4], [ASC, MC], [0, 180], $na_planet) || checkPhase([4], [0, 1, 5], [], $na_planet))
                    {
                        $level++;
                    }
                    $result[] = [
                        'name' => $day_jianshen,
                        'star_level' => $level,
                        'tips' => $day_jianshen_des,
                        'icon_url' => $icon_url3,
                        'tips_url' => $icon_url3_pop
                    ];
                }
            }
        }


        //学习之日
        //	tp月亮在3/9宫无刑相位，或tp月亮与水星或木星成非刑相，或tp水星木星成非刑相，或tr木星与本命水星成相
        //		tr日木/日水/水日/水木/水月/水金成非刑相，或日金水过39宫与本命星成非刑相【以上相位三个以上为3星，只有1个是1星，其余两星】
        //	脑力活跃，适合读书学习思考，难题会迎刃而解，课题研究也会灵感迸发，事半功倍。学习是一辈子的事，不管你是不是学生，都要不断学习才能跟上时代的脚步。
        $level = 0;
        $tp1_house39_phase90_num = 0;
        if (in_array($tp_planet[1]['in_house_id'], [3, 9]))
        {
            if (!empty($tp_planet[1]['phase']))
            {
                foreach ($tp_planet[1]['phase'] as $phase)
                {
                    if ($phase['phase_e'] == 90) $tp1_house39_phase90_num++;
                }
            }
        }
        if ($tp1_house39_phase90_num == 0
            || checkPhase([1], [2, 5], [0, 60, 120, 180], $tp_planet)
            || checkPhase([2], [5], [0, 60, 120, 180], $tp_planet)
            || checkPhase([5], [2], [], $tr_planet)
        )
        {
            $phase_num = 0;
            if (checkPhase([0], [5], [0, 60, 120, 180], $tr_planet)) $phase_num++;
            if (checkPhase([0], [2], [0, 60, 120, 180], $tr_planet)) $phase_num++;
            if (checkPhase([2], [0], [0, 60, 120, 180], $tr_planet)) $phase_num++;
            if (checkPhase([2], [5], [0, 60, 120, 180], $tr_planet)) $phase_num++;
            if (checkPhase([2], [1], [0, 60, 120, 180], $tr_planet)) $phase_num++;
            if (checkPhase([2], [3], [0, 60, 120, 180], $tr_planet)) $phase_num++;
            foreach ([0, 2, 3] as $i)
            {
                if (in_array($tr_planet[$i]['in_house_id'], [3, 9]) && !empty($tr_planet[$i]['phase']))
                {
                    foreach ($tr_planet[$i]['phase'] as $phase)
                    {
                        if ($phase['phase_e'] != 90) $phase_num++;
                    }
                }
            }
            if ($phase_num >= 3) $level = 3;
            elseif ($phase_num == 2) $level = 2;
            elseif ($phase_num == 1) $level = 1;

            if ($level > 0)
            {
                $result[] = [
                    'name' => $day_xuexi,
                    'star_level' => $level,
                    'tips' => $day_xuexi_des,
                    'icon_url' => $icon_url3,
                    'tips_url' => $icon_url3_pop
                ];
            }
        }


        //医药之日 TODO 待完成
        //	tp月亮过6宫被刑冲且tr火土天海冥6宫与本命星合刑冲（天海冥仅对日月金水火相位有效），或，tp月亮过6宫同时与火土天海冥之二刑冲
        //		tr火星合刑冲上升（0.5度内1星，0.2度内2星），或，本命火星与tr行星刑冲且tr火星过轴或合刑冲6/8宫宫内星（两个相位容许和小于等于1.31星，6/8宫内星同时有土天海冥0.5度内刑冲2星）
        //	TODO 整宫或普拉西度分宫下，本命命主落8宫与6宫星体成相或与任意星刑冲或命主6宫与8宫星体成相或受刑冲，则，tr火星合刑冲命主且日月水之一与命主刑冲，或“火土一刑冲合命度一合刑冲命主或月亮”，或，tp月亮刑冲合海王且火星在6宫且太阳在12宫
        //		1星，健康活跃高于80+1星
        //	tp月亮合刑冲海王，且tr火土天海冥在6/8宫与本命日月金水火木土成相（天海冥需逆行）
        //		健康活跃高于50时1星
        //增加一条逻辑 20180912
        //前提：tp月亮与火土冥海刑冲，或在6/8/12宫与火土冥海合
        //判断：tr火星或缓滞状态的水土海与6/8宫内的日月金水火成相，tr日金水恰好与同一颗星合刑冲【此时该本命星有三个以上合刑冲相3星，有三个以上相位但只有一两个合刑冲2星，否则1星】
        //	容易感觉劳累，可能身体会添点小毛病，去医院检查身体、求医问药，都是寻常事。没什么大问题就等于没有问题，但身体是人生最宝贵的财产，请一定要好好珍惜。

        $level = 0;
        $is_moon_phase90180 = false;
        $moon_phase46789_90180_num = 0;
        if (!empty($tp_planet[1]['phase']))
        {
            foreach ($tp_planet[1]['phase'] as $phase)
            {
                if (in_array($phase['phase_e'], [90, 180]))
                {
                    $is_moon_phase90180 = true;
                    if (in_array($phase['id'], [4, 6, 7, 8, 9]))
                    {
                        $moon_phase46789_90180_num++;
                    }
                }
            }
        }
        $is_tr46789_house6_phase090180 = false;
        foreach ([4, 6, 7, 8, 9] as $i)
        {
            if (!empty($tr_planet[$i]['phase']))
            {
                foreach ($tr_planet[$i]['phase'] as $phase)
                {
                    if (
                        $tr_planet[$i]['in_house_id'] == 6
                        &&
                        (
                            (in_array($i, [4, 6]) && in_array($phase['phase_e'], [0, 90, 180]))
                            || (in_array($i, [7, 8, 9]) && in_array($phase['id'], [0, 1, 2, 3, 4]) && in_array($phase['phase_e'], [0, 90, 180]))
                        )
                    )
                    {
                        $is_tr46789_house6_phase090180 = true;
                    }
                }
            }
        }

        if (checkSignHouse([1], [6], $tp_planet)
            && (($is_moon_phase90180 && $is_tr46789_house6_phase090180)
                || $moon_phase46789_90180_num >= 2)
        )
        {
            //tr火星合刑冲上升（0.5度内1星，0.2度内2星），
            // TODO 或，本命火星与tr行星刑冲且tr火星过轴或合刑冲6/8宫宫内星（两个相位容许和小于等于1.31星，6/8宫内星同时有土天海冥0.5度内刑冲2星）
            if ($level < 2 && checkPhase([4], [ASC], [0, 90, 180], $tr_planet, 0.2))
            {
                $level = 2;
            } elseif ($level < 1 && checkPhase([4], [ASC], [0, 90, 180], $tr_planet, 0.5))
            {
                $level = 1;
            }

        }

        if (checkPhase([1], [8], [0, 90, 180], $tp_planet)
            &&
            (
                (checkSignHouse([4], [6, 8], $tr_planet) && checkPhase([4], [0, 1, 2, 3, 4, 5, 6], [], $tr_planet))
                || (checkSignHouse([6], [6, 8], $tr_planet) && checkPhase([6], [0, 1, 2, 3, 4, 5, 6], [], $tr_planet))
                || (checkSignHouse([7], [6, 8], $tr_planet) && $tr_planet[7]['speed'] < 0 && checkPhase([7], [0, 1, 2, 3, 4, 5, 6], [], $tr_planet))
                || (checkSignHouse([8], [6, 8], $tr_planet) && $tr_planet[8]['speed'] < 0 && checkPhase([8], [0, 1, 2, 3, 4, 5, 6], [], $tr_planet))
                || (checkSignHouse([9], [6, 8], $tr_planet) && $tr_planet[9]['speed'] < 0 && checkPhase([9], [0, 1, 2, 3, 4, 5, 6], [], $tr_planet))
            )
        )
        {
            if (!$level && $this->active['health'] > 50)
            {
                $level = 1;
            }
        }
        if (checkPhase([1], [4, 6, 8, 9], [90, 180], $tp_planet)
            || (checkSignHouse([1], [6, 8, 12], $tp_planet) && checkPhase([1], [4, 6, 8, 9], [0], $tp_planet)))
        {
            if (
                checkSignHouse([0], [6, 8], $na_planet)
                &&
                (
                    checkPhase([4], [0], [], $tr_planet)
                    || ($tr_planet[2]['speed'] < config('astrolog.speed')[2] && checkPhase([2], [0], [], $tr_planet))
                    || ($tr_planet[6]['speed'] < config('astrolog.speed')[6] && checkPhase([6], [0], [], $tr_planet))
                    || ($tr_planet[8]['speed'] < config('astrolog.speed')[8] && checkPhase([8], [0], [], $tr_planet))
                )
                && checkPhase([0, 2, 3], [0], [0, 90, 180], $tr_planet)
            )
            {
                $phase090180_num = 0;
                $phase_num = 0;
                if (!empty($tr_planet2[0]['phase']))
                {
                    foreach ($tr_planet2[0]['phase'] as $phase)
                    {
                        $phase_num++;
                        if (in_array($phase['phase_e'], [0, 90, 180]))
                        {
                            $phase090180_num++;
                        }
                    }
                }
                if ($level < 3 && $phase090180_num >= 3)
                {
                    $level = 3;
                } elseif ($level < 2 && $phase_num >= 3 && $phase090180_num > 0 && $phase090180_num < 3)
                {
                    $level = 2;
                } elseif (!$level)
                {
                    $level = 1;
                }
            }
            if (
                checkSignHouse([1], [6, 8], $na_planet)
                &&
                (
                    checkPhase([4], [1], [], $tr_planet)
                    || ($tr_planet[2]['speed'] < config('astrolog.speed')[2] && checkPhase([2], [1], [], $tr_planet))
                    || ($tr_planet[6]['speed'] < config('astrolog.speed')[6] && checkPhase([6], [1], [], $tr_planet))
                    || ($tr_planet[8]['speed'] < config('astrolog.speed')[8] && checkPhase([8], [1], [], $tr_planet))
                )
                && checkPhase([0, 2, 3], [1], [0, 90, 180], $tr_planet)
            )
            {
                $phase090180_num = 0;
                $phase_num = 0;
                if (!empty($tr_planet2[1]['phase']))
                {
                    foreach ($tr_planet2[1]['phase'] as $phase)
                    {
                        $phase_num++;
                        if (in_array($phase['phase_e'], [0, 90, 180]))
                        {
                            $phase090180_num++;
                        }
                    }
                }
                if ($level < 3 && $phase090180_num >= 3)
                {
                    $level = 3;
                } elseif ($level < 2 && $phase_num >= 3 && $phase090180_num > 0 && $phase090180_num < 3)
                {
                    $level = 2;
                } elseif (!$level)
                {
                    $level = 1;
                }
            }
            if (
                checkSignHouse([2], [6, 8], $na_planet)
                &&
                (
                    checkPhase([4], [2], [], $tr_planet)
                    || ($tr_planet[2]['speed'] < config('astrolog.speed')[2] && checkPhase([2], [2], [], $tr_planet))
                    || ($tr_planet[6]['speed'] < config('astrolog.speed')[6] && checkPhase([6], [2], [], $tr_planet))
                    || ($tr_planet[8]['speed'] < config('astrolog.speed')[8] && checkPhase([8], [2], [], $tr_planet))
                )
                && checkPhase([0, 2, 3], [2], [0, 90, 180], $tr_planet)
            )
            {
                $phase090180_num = 0;
                $phase_num = 0;
                if (!empty($tr_planet2[2]['phase']))
                {
                    foreach ($tr_planet2[2]['phase'] as $phase)
                    {
                        $phase_num++;
                        if (in_array($phase['phase_e'], [0, 90, 180]))
                        {
                            $phase090180_num++;
                        }
                    }
                }
                if ($level < 3 && $phase090180_num >= 3)
                {
                    $level = 3;
                } elseif ($level < 2 && $phase_num >= 3 && $phase090180_num > 0 && $phase090180_num < 3)
                {
                    $level = 2;
                } elseif (!$level)
                {
                    $level = 1;
                }
            }
            if (
                checkSignHouse([3], [6, 8], $na_planet)
                &&
                (
                    checkPhase([4], [3], [], $tr_planet)
                    || ($tr_planet[2]['speed'] < config('astrolog.speed')[2] && checkPhase([2], [3], [], $tr_planet))
                    || ($tr_planet[6]['speed'] < config('astrolog.speed')[6] && checkPhase([6], [3], [], $tr_planet))
                    || ($tr_planet[8]['speed'] < config('astrolog.speed')[8] && checkPhase([8], [3], [], $tr_planet))
                )
                && checkPhase([0, 2, 3], [0], [0, 90, 180], $tr_planet)
            )
            {
                $phase090180_num = 0;
                $phase_num = 0;
                if (!empty($tr_planet2[3]['phase']))
                {
                    foreach ($tr_planet2[3]['phase'] as $phase)
                    {
                        $phase_num++;
                        if (in_array($phase['phase_e'], [0, 90, 180]))
                        {
                            $phase090180_num++;
                        }
                    }
                }
                if ($level < 3 && $phase090180_num >= 3)
                {
                    $level = 3;
                } elseif ($level < 2 && $phase_num >= 3 && $phase090180_num > 0 && $phase090180_num < 3)
                {
                    $level = 2;
                } elseif (!$level)
                {
                    $level = 1;
                }
            }
            if (
                checkSignHouse([4], [6, 8], $na_planet)
                &&
                (
                    checkPhase([4], [4], [], $tr_planet)
                    || ($tr_planet[2]['speed'] < config('astrolog.speed')[2] && checkPhase([2], [4], [], $tr_planet))
                    || ($tr_planet[6]['speed'] < config('astrolog.speed')[6] && checkPhase([6], [4], [], $tr_planet))
                    || ($tr_planet[8]['speed'] < config('astrolog.speed')[8] && checkPhase([8], [4], [], $tr_planet))
                )
                && checkPhase([0, 2, 3], [4], [0, 90, 180], $tr_planet)
            )
            {
                $phase090180_num = 0;
                $phase_num = 0;
                if (!empty($tr_planet2[4]['phase']))
                {
                    foreach ($tr_planet2[4]['phase'] as $phase)
                    {
                        $phase_num++;
                        if (in_array($phase['phase_e'], [0, 90, 180]))
                        {
                            $phase090180_num++;
                        }
                    }
                }
                if ($level < 3 && $phase090180_num >= 3)
                {
                    $level = 3;
                } elseif ($level < 2 && $phase_num >= 3 && $phase090180_num > 0 && $phase090180_num < 3)
                {
                    $level = 2;
                } elseif (!$level)
                {
                    $level = 1;
                }
            }
        }

        if ($level)
        {
            $result[] = [
                'name' => $day_yiyao,
                'star_level' => $level,
                'tips' => $day_yiyao_des,
                'icon_url' => $icon_url4,
                'tips_url' => $icon_url4_pop
            ];
        }

        //挑战之日 20180905 修改词条并新增条件3 20180910  tr部分 火与本命日月火 改为 火与本命日月水火
        // 1.tp月亮与火土海冥刑冲，或tp月亮与火星合拱六分且不与金木成相
        //  tr火过轴（1度内），或火与本命日月火成合刑冲相，或日与本命火合刑冲，或滞缓状态下的水与本命火刑冲（1度内2星，2度内1星）
        // 2.tp月亮参与T三角，与火土天海冥之一构成刑冲
        //  tr日火与本命火星成相，2度内1星，1度内2星，若tp月亮与火土天海冥之三颗有相位且无金木非刑冲相，+1星
        // 3.行运火星与本命日月20分内成相，且tp满足下列条件之一：1月亮与火星刑冲；2月亮与火星合拱六分且不与金木合拱六分；3月亮不与金木合拱六分且太阳与火星成相
        //  火星缓滞状态为3星，否则2星
        // 这一天容易感觉自己被冒犯被伤害，或面临竞争，气愤，烦躁不安，甚至出现对立和争吵。冲动会让事情变得更坏，你需要寻找一个理性释放的渠道，平心静气地去解决所面临的问题。同时，也要警惕发烧、上火以及伤灾的可能。
        // 这一天容易感觉自己被冒犯被伤害，或面临竞争，气愤，烦躁不安，甚至出现对立和争吵。也可能是有一些突发的事情，让你焦躁、忙乱，内心不太平静。同时，也要警惕发烧、上火以及伤灾的可能。总之你要小心行事，凡事不大意，不冲动。

        $level = 0;
        if (checkPhase([1], [4, 6, 8, 9], [90, 180], $tp_planet)
            || (checkPhase([1], [4], [0, 60, 120], $tp_planet) && !checkPhase([1], [3, 5], [0, 60, 120, 180], $tp_planet)))
        {
            if (checkPhase([4], [ASC, MC], [0, 180], $tr_planet, 1))
            {
                $level = 2;
            }
            if ($level < 2 && checkPhase([4], [0, 1, 2, 4], [0, 90, 180], $tr_planet))
            {
//                echo 1;exit;
                if (checkPhase([4], [0, 1, 2, 4], [0, 90, 180], $tr_planet, 1))
                {
                    $level = 2;
                } else
                {
                    $level = 1;
                }
            }
            if ($level < 2 && checkPhase([0], [4], [0, 90, 180], $tr_planet))
            {
                if (checkPhase([0], [4], [0, 90, 180], $tr_planet, 1))
                {
                    $level = 2;
                } else
                {
                    $level = 1;
                }
            }
            if ($level < 2 && checkPhase([2], [4], [90, 180], $tr_planet)
                && abs($tr_planet[2]['speed']) < config('astrolog.speed')[2])
            {
                if (checkPhase([2], [4], [90, 180], $tr_planet, 1))
                {
                    $level = 2;
                } else
                {
                    $level = 1;
                }
            }
        }
        if ($is_moon_in_t_square && checkPhase([1], [4, 6, 7, 8, 9], [90, 180], $tp_planet))
        {
            if (!empty($this->transitsData[0]['planets'][4]['phase']))
            {
                foreach ($this->transitsData[0]['planets'][4]['phase'] as $phase)
                {
                    if ($level < 2 && in_array($phase['id'], [0, 4]))
                    {
                        if ($phase['phase_orb'] < 1)
                        {
                            $level = 2;
                        } elseif ($phase['phase_orb'] < 2)
                        {
                            $level = 1;
                        }
                    }
                }
            }
            if ($level && !checkPhase([1], [3, 5], [0, 60, 120], $tp_planet))
            {
                $moon_phase46789_num = 0;
                if (!empty($tp_planet[1]['phase']))
                {
                    foreach ($tp_planet[1]['phase'] as $phase)
                    {
                        if (in_array($phase['id'], [4, 6, 7, 8, 9]))
                        {
                            $moon_phase46789_num++;
                        }
                    }
                }
                if ($moon_phase46789_num >= 3)
                {
                    $level++;
                }
            }
        }
        if ($level < 3
            &&
            checkPhase([4], [0, 1], [], $tr_planet, 1 / 3)
            &&
            (
                checkPhase([1], [4], [90, 180], $tp_planet)
                || (checkPhase([1], [4], [0, 60, 120], $tp_planet) && !checkPhase([1], [3, 5], [0, 60, 120], $tp_planet))
                || (!checkPhase([1], [3, 5], [0, 60, 120], $tp_planet) && checkPhase([0], [4], [], $tp_planet))
            )
        )
        {
            if ($tr_planet[4]['speed'] <= config('astrolog.speed')[4])
            {
                $level = 3;
            } elseif ($level < 2)
            {
                $level = 2;
            }
        }

        if ($level)
        {
            $result[] = [
                'name' => $day_tiaozhan,
                'star_level' => $level,
                'tips' => $day_tiaozhan_des,
                'icon_url' => $icon_url4,
                'tips_url' => $icon_url4_pop
            ];
        }


        //迷乱之日
        //	tp月亮与海王合刑冲;或tp海王与日水金火之二同时刑冲此时月亮与海王成相
        //		tp月亮在4/8/12，或tr太阳在4/8/12
        //			tr水星或火星合轴;
        //          或，tr水星或火星与本命日月刑冲，
        //          或，tr太阳与本命水火刑冲
        //          【以上相位中最紧密相位1度内（tr火星相位则为0.5度内）2星，2度内（tr火星相位则为1度内）1星，
        //          同时出现两个以上相位则+1星】
        //	你处于大脑不太清醒的时期，容易遭受蛊惑和欺骗，或者做出一些非理性行为。有时你会感觉迷失方向，找不到工作生活的目标，胡思乱想，甚至被汹涌泛滥的情绪淹没。不要轻易作出任何重要决定，以免追悔莫及。
        $level = 0;
        $tp_8_phase_0234_num = 0;
        if (!empty($tp_planet[8]['phase']))
        {
            foreach ($tp_planet[8]['phase'] as $phase)
            {
                if (in_array($phase['id'], [0, 2, 3, 4]) && in_array($phase['phase_e'], [90, 180]))
                {
                    $tp_8_phase_0234_num++;
                }
            }
        }
        if (checkPhase([1], [8], [0, 90, 180], $tp_planet)
            || ($tp_8_phase_0234_num >= 2 && checkPhase([1], [8], [], $tp_planet)))
        {
            if (checkSignHouse([1], [4, 8, 12], $tp_planet) || checkSignHouse([0], [4, 8, 12], $tr_planet))
            {
                $orb_min = 20;
                $is_tr_4 = false;
                $phase_num = 0;
                $cond1 = false;
                $cond2 = false;
                $cond3 = false;
                if (!empty($tr_planet[2]['phase']))
                {
                    foreach ($tr_planet[2]['phase'] as $phase)
                    {
                        if (in_array($phase['id'], [ASC, MC]) && in_array($phase['phase_e'], [0, 180]))
                        {
                            $cond1 = true;
                            if ($phase['phase_orb'] < $orb_min)
                            {
                                $is_tr_4 = false;
                                $orb_min = $phase['phase_orb'];
                            }
                            $phase_num++;
                        }
                        if (in_array($phase['id'], [0, 1]) && in_array($phase['phase_e'], [90, 180]))
                        {
                            $cond2 = true;
                            if ($phase['phase_orb'] < $orb_min)
                            {
                                $is_tr_4 = false;
                                $orb_min = $phase['phase_orb'];
                            }
                            $phase_num++;
                        }
                    }
                }
                if (!empty($tr_planet[4]['phase']))
                {
                    foreach ($tr_planet[4]['phase'] as $phase)
                    {
                        if (in_array($phase['id'], [ASC, MC]) && in_array($phase['phase_e'], [0, 180]))
                        {
                            $cond1 = true;
                            if ($phase['phase_orb'] < $orb_min)
                            {
                                $is_tr_4 = true;
                                $orb_min = $phase['phase_orb'];
                            }
                            $phase_num++;
                        }
                        if (in_array($phase['id'], [0, 1]) && in_array($phase['phase_e'], [90, 180]))
                        {
                            $cond2 = true;
                            if ($phase['phase_orb'] < $orb_min)
                            {
                                $is_tr_4 = true;
                                $orb_min = $phase['phase_orb'];
                            }
                            $phase_num++;
                        }
                    }
                }
                if (!empty($tr_planet[0]['phase']))
                {
                    foreach ($tr_planet[0]['phase'] as $phase)
                    {
                        if (in_array($phase['id'], [2, 4]) && in_array($phase['phase_e'], [90, 180]))
                        {
                            $cond3 = true;
                            if ($phase['phase_orb'] < $orb_min)
                            {
                                $is_tr_4 = false;
                                $orb_min = $phase['phase_orb'];
                            }
                            $phase_num++;
                        }
                    }
                }
                if ($cond1 || $cond2 || $cond3)
                {
                    $l2_limit = $is_tr_4 ? 0.5 : 1;
                    $l1_limit = $is_tr_4 ? 1 : 2;
                    if ($orb_min < $l2_limit)
                    {
                        $level = 2;
                    } elseif ($orb_min < $l1_limit)
                    {
                        $level = 1;
                    }
                    if ($level && $phase_num >= 2)
                    {
                        $level++;
                    }
                }
            }
        }

        if ($level)
        {
            $result[] = [
                'name' => $day_miluan,
                'star_level' => $level,
                'tips' => $day_miluan_des,
                'icon_url' => $icon_url4,
                'tips_url' => $icon_url4_pop
            ];
        }

        //蛰伏之日
        //	tr太阳4/8/12宫且月亮12宫，1星，若tr日水金火均不与本命日月水金火成相，2星
        //	也许突然觉得倦怠，想要独处的需求占了上风。你宁愿一个人蜷缩在家里，整理心事，或者做自己想做的事情。养精蓄锐是最近的主题，人总是需要适当的休养生息，充好电再精神抖擞地上路。
        $level = 0;
        if (checkSignHouse([0], [4, 8, 12], $tr_planet) && checkSignHouse([1], [12], $tr_planet))
        {
            $level = 1;
            if (!checkPhase([0, 2, 3, 4], [0, 1, 2, 3, 4], [], $tr_planet))
            {
                $level = 2;
            }
        }

        if ($level)
        {
            $result[] = [
                'name' => $day_zhefu,
                'star_level' => $level,
                'tips' => $day_zhefu_des,
                'icon_url' => $icon_url4,
                'tips_url' => $icon_url4_pop
            ];
        }

        // 情殇之日，“tp月亮与金星成相且与火土天海冥之二刑冲”，加条件“此时金星与木星合拱六分且不与火土天海冥刑冲 除外”
        //情殇之日
        //	tp月亮与金星成相且与火土天海冥之二刑冲，
        //  或，tp土天海冥之二在7宫且其一与月亮成相同时tr日金水火与本命金星或5宫宫内星刑冲（2个以上），
        //  或，tp月亮过5宫与火土天海冥之一（或8宫日水之一）刑冲且金星与土天海冥之一刑冲，
        //  或，tp天王1度内合轴且月亮与金星刑，
        //  或，tp金星参与T三角（火土海冥之二参与）且月亮刑冲天王
        //		tr太阳刑冲本命火土天海冥或5宫宫内星，
        //      或，tr金火过轴或与本命日月金火或5宫宫内星成相
        //      【以上各相位中最紧密的小于0.8度2星，小于1.6度1星，如出现两个以上相位+1星】
        //	请一定小心情感伤害。欢聚未必带来快乐，期待已久的见面可能闹得不欢而散，甚至会就此分手。
        //【tr太阳刑冲本命火土天海冥或5宫宫内星】调整为 【日金在5宫刑冲合火土天海冥，或刑冲5宫的火土天海冥】
        //请一定小心情感伤害。欢聚未必带来快乐，期待已久的见面可能闹得不欢而散。在人际关系方面，你也容易遭遇挫败，与他人相处不够融洽。这种日子不适合表白、合作，也不适合向他人做出重要的要求或提议。
        $level = 0;

        $tp_moon_phase46789_90180_num = 0;
        if (!empty($tp_planet[1]['phase']))
        {
            foreach ($tp_planet[1]['phase'] as $phase)
            {
                if (in_array($phase['id'], [4, 6, 7, 8, 9]) && in_array($phase['phase_e'], [90, 180]))
                {
                    $tp_moon_phase46789_90180_num++;
                }
            }
        }
        $tp6789_house7_num = 0;
        $tp6789_house7_phase1_num = 0;
        foreach ([6, 7, 8, 9] as $i)
        {
            if ($tp_planet[$i]['in_house_id'] == 7)
            {
                $tp6789_house7_num++;
                if (isset($tp_planet[$i]['phase'][$i . '-1']))
                {
                    $tp6789_house7_phase1_num++;
                }
            }
        }
        $tr_0234_phase3_or_house5_90180_num = 0;
        foreach ([0, 2, 3, 4] as $i)
        {
            if (!empty($tr_planet[$i]['phase']))
            {
                foreach ($tr_planet[$i]['phase'] as $phase)
                {
                    if (in_array($phase['phase_e'], [90, 180])
                        && ($phase['id'] == 3 || $na_planet[$phase['id']]['in_house_id'] == 5)
                    )
                    {
                        $tr_0234_phase3_or_house5_90180_num++;
                    }
                }
            }
        }
        $tp4689_in_t_square_num = 0;
        if ($is_mars_in_t_square) $tp4689_in_t_square_num++;
        if ($is_satu_in_t_square) $tp4689_in_t_square_num++;
        if ($is_nept_in_t_square) $tp4689_in_t_square_num++;
        if ($is_plut_in_t_square) $tp4689_in_t_square_num++;

        if ((checkPhase([1], [3], [], $tp_planet) && $tp_moon_phase46789_90180_num >= 2 && (!checkPhase([3], [5], [0, 60, 120], $tp_planet) || !checkPhase([1], [4, 6, 7, 8, 9], [90, 180], $tp_planet)))
            || ($tp6789_house7_num >= 2 && $tp6789_house7_phase1_num >= 1)
            || (checkSignHouse([1], [5], $tp_planet)
                && (checkPhase([1], [4, 6, 7, 8, 9], [90, 180], $tp_planet)
                    || (checkSignHouse([0], [8], $tp_planet) && checkPhase([1], [0], [90, 180], $tp_planet))
                    || (checkSignHouse([2], [8], $tp_planet) && checkPhase([1], [2], [90, 180], $tp_planet)))
                && checkPhase([3], [6, 7, 8, 9], [90, 180], $tp_planet))
            || (checkPhase([7], [ASC, MC], [0, 180], $tp_planet, 1)
                && checkPhase([1], [3], [90], $tp_planet))
            || (checkPhase([1], [7], [90, 180], $tp_planet) && $is_venu_in_t_square && $tp4689_in_t_square_num >= 2)
        )
        {
            $orb_min = 20;
            $cond = false;
            $phase_num = 0;
            //tr太阳刑冲本命火土天海冥或5宫宫内星 调整为 日金在5宫刑冲合火土天海冥，或刑冲5宫的火土天海冥 20180910
            foreach ([0, 3] as $i)
            {
                if (!empty($tr_planet[$i]['phase']))
                {
                    foreach ($tr_planet[$i]['phase'] as $phase)
                    {
                        if (in_array($phase['id'], [4, 6, 7, 8, 9]) && in_array($phase['phase_e'], [0, 90, 180]))
                        {
                            if ($tr_planet[$i]['in_house_id'] == 5
                                || ($na_planet[$phase['id']]['in_house_id'] == 5
                                    && in_array($phase['phase_e'], [90, 180])))
                            {
                                $cond = true;
                                if ($phase['phase_orb'] < $orb_min)
                                {
                                    $orb_min = $phase['phase_orb'];
                                }
                            }
                        }
                    }
                }
            }
            foreach ([3, 4] as $i)
            {
                if (!empty($tr_planet[$i]['phase']))
                {
                    foreach ($tr_planet[$i]['phase'] as $phase)
                    {
                        if ((in_array($phase['id'], [ASC, MC]) && in_array($phase['phase_e'], [0, 180]))
                            || in_array($phase['id'], [0, 1, 3, 4])
                            || $na_planet[$phase['id']]['in_house_id'] == 5)
                        {
                            $cond = true;
                            $phase_num++;
                            if ($phase['phase_orb'] < $orb_min)
                            {
                                $orb_min = $phase['phase_orb'];
                            }
                        }
                    }
                }
            }
            if ($cond)
            {
                if ($orb_min < 0.8)
                {
                    $level = 2;
                } elseif ($orb_min <= 1.6)
                {
                    $level = 1;
                }

                if ($level && $phase_num >= 2)
                {
                    $level++;
                }
            }
        }

        if ($level)
        {
            $result[] = [
                'name' => $day_qingshang,
                'star_level' => $level,
//                'tips' => '请一定小心情感伤害。欢聚未必带来快乐，期待已久的见面可能闹得不欢而散，甚至会就此分手。',
                'tips' => $day_qingshang_des,
                'icon_url' => $icon_url5,
                'tips_url' => $icon_url5_pop
            ];
        }

        //受难之日 20180930 受难之日逻辑修改
        //tp月亮同时刑冲火土天海冥之二并参与T三角，
        //或tp月亮过8宫12宫并与火土天海冥之一刑冲并与另一合拱六分，
        //或tp月亮过8/12宫并与火土天海冥之二刑冲（例外：火土天海冥中，若月亮仅与天海成相位且同时与金木之一成非刑相，本条不成立）
        //	tr日金水之一在8/12宫与本命火星合刑冲或与土天海冥之二合刑冲【与火星1度内或与土天海冥容许和1.6度内2星，否则1星】
        //	tr日与本命火星成相【1度内2星，2度内1星，若tr日月合或日位于8/12宫，+1星】
        //	tr火星合升降或火星刑冲本命日月，0.5度内2星，1度内1星，行运月亮与行运火星合+1星

        //受难之日
        //	tp月亮同时刑冲火土天海冥之二并参与T三角，
        //  或tp月亮过8宫12宫并与火土天海冥之一刑冲并与另一合拱六分，
        //  或tp月亮过8/12宫并与火土天海冥之二刑冲
        //  或tp月亮过8/12宫并与火土海冥之一刑冲同时太阳与火土海冥之一刑冲且日月不同时与金木成相 20180911 新增条件
        //		tr日金水之一在8/12宫与本命火星合刑冲或与土天海冥之二合刑冲【与火星1度内或与土天海冥容许和1.6度内2星，否则1星】
        //		tr日与本命火星成相【1度内2星，2度内1星，若tr日月合或日位于8/12宫，+1星】
        //		tr火星合轴或火星刑冲本命日月，0.5度内2星，1度内1星，行运月亮与行运火星合+1星 20180911 修改为 tr火星合轴或火星刑冲合本命日月，0.5度内2星，1度内1星，行运月亮与行运火星合+1星
        //	近期可能会霉运罩头。也许你仅仅是不太开心，没什么特别的遭遇，但还是要警惕一些失败、痛苦和考验。这是一个运势的低谷期，不建议做任何重要决策，能平静度过就是最好。当然也不用悲观，能在此时发现问题，努力解决，不久你就会迎来新一轮运势的高潮。
        $level = 0;
        $cond2 = false;
        $cond3_num = 0;
        $tp1_phase78 = false;
        $tp1_phase_no78 = false;
        $tp1_phase35_no90 = false;
        if (!empty($tp_planet[1]['phase']))
        {
            foreach ($tp_planet[1]['phase'] as $phase)
            {
                $arr = [4, 6, 7, 8, 9];
                if (in_array($phase['id'], $arr) && in_array($phase['phase_e'], [90, 180]))
                {
                    $cond3_num++;
                    foreach ($arr as $j)
                    {
                        if ($j != $phase['id'] && isset($tp_planet[1]['phase']['1-' . $j])
                            && in_array($tp_planet[1]['phase']['1-' . $j]['phase_e'], [0, 60, 120]))
                        {
                            $cond2 = true;
                        }
                    }
                }
                if (in_array($phase['id'], [7, 8])) $tp1_phase78 = true;
                if (in_array($phase['id'], $arr) && !in_array($phase['id'], [7, 8])) $tp1_phase_no78 = true;
                if ($phase['phase_e'] != 90 && in_array($phase['id'], [3, 5])) $tp1_phase35_no90 = true;
            }
        }
        if ($tp1_phase78 === false || $tp1_phase_no78 === true || $tp1_phase35_no90 === false)
        {
            if (($tp_moon_phase46789_90180_num >= 2 && $is_moon_in_t_square)
                || (checkSignHouse([1], [8, 12], $tp_planet)
                    && (
                        $cond2 || $cond3_num >= 2
                        ||
                        (
                            checkPhase([1], [4, 6, 8, 9], [90, 180], $tp_planet)
                            && checkPhase([0], [4, 6, 8, 9], [90, 180], $tp_planet)
                            && (!checkPhase([0], [3, 5], [], $tp_planet) || !checkPhase([1], [3, 5], [], $tp_planet))
                        )
                    ))
            )
            {
                foreach ([0, 2, 3] as $i)
                {
                    $phase6789_num = 0;// 日金水与土天海冥刑冲数量
                    $phase6789_orb_sum = [];// 日金水与土天海冥刑冲相位容许度
                    if (in_array($tr_planet[$i]['in_house_id'], [8, 12]) && !empty($tr_planet[$i]['phase']))
                    {
                        foreach ($tr_planet[$i]['phase'] as $phase)
                        {
                            if ($phase['id'] == 4 && in_array($phase['phase_e'], [0, 90, 180]))
                            {
                                if ($level < 2 && $phase['phase_orb'] < 1)
                                {
                                    $level = 2;
                                } elseif (!$level)
                                {
                                    $level = 1;
                                }
                            }
                            if (in_array($phase['id'], [6, 7, 8, 9]) && in_array($phase['phase_e'], [0, 90, 180]))
                            {
                                $phase6789_num++;
                                $phase6789_orb_sum[] = $phase['phase_orb'];
                            }
                        }
                    }

                    sort($phase6789_orb_sum);

                    if ($level < 2 && $phase6789_num >= 2)
                    {
                        if ($phase6789_orb_sum[0] + $phase6789_orb_sum[1] < 1.6)
                        {
                            $level = 2;
                        } elseif (!$level)
                        {
                            $level = 1;
                        }
                    }
                }

                if (isset($tr_planet[0]['phase']['0-4']))
                {
                    $orb = $tr_planet[0]['phase']['0-4']['phase_orb'];
                    if ($level < 2 && $orb < 1)
                    {
                        $level = 2;
                    } elseif (!$level && $orb < 2)
                    {
                        $level = 1;
                    }
                    if ($orb < 2 && (checkPhase([0], [1], [0], $tr_planet) || checkSignHouse([0], [8, 12], $tr_planet)))
                    {
                        $level++;
                    }
                }

                if ($level < 3 && checkPhase([4], [ASC], [0, 180], $tr_planet, 0.5))
                {
                    $level = 2;
                    if (checkPhase([1], [4], [0], $tx_planet))
                    {
                        $level++;
                    }
                } elseif ($level < 2 && checkPhase([4], [ASC], [0, 180], $tr_planet, 1))
                {
                    $level = 1;
                    if (checkPhase([1], [4], [0], $tx_planet))
                    {
                        $level++;
                    }
                }
                if ($level < 3 && checkPhase([4], [0, 1], [0, 90, 180], $tr_planet, 0.5))
                {
                    $level = 2;
                    if (checkPhase([1], [4], [0], $tx_planet))
                    {
                        $level++;
                    }
                } elseif ($level < 2 && checkPhase([4], [0, 1], [0, 90, 180], $tr_planet, 1))
                {
                    $level = 1;
                    if (checkPhase([1], [4], [0], $tx_planet))
                    {
                        $level++;
                    }
                }
            }
        }

        if ($level)
        {
            $result[] = [
                'name' => $day_shounan,
                'star_level' => $level,
                'tips' => $day_shounan_des,
                'icon_url' => $icon_url5,
                'tips_url' => $icon_url5_pop
            ];
        }

        //锥心之日
        //tp金冥刑冲且冥王与月亮成相，或tp金冥合拱六分且冥王与月亮刑冲
        // tr日金水火之二与本命冥王成相，
        // 或，tr日金水之一刑冲冥王并与火星成相
        //     【行运盘日金水火刑冲多于3组且tp月亮在4/8/12宫三星，
        //      行运盘日金水火刑冲少于3组多于1组且tp月亮在4/8/12宫两星，
        //      行运盘日金水火刑冲多于3组但月亮不在4/8/12宫两星，其余1星】
        //这一天会有些痛苦纠结的情绪产生，比如回想起失去的爱情，深夜一个人坐在床头为一段感情痛哭，不得不面对关系中最难堪的部分，伴随着痛悔和醒悟。你可能觉得生活一团糟乱，也可能有莫名的危机感。
        $level = 0;
        if ((checkPhase([3], [9], [90, 180], $tp_planet) && checkPhase([1], [9], [], $tp_planet))
            || (checkPhase([3], [9], [0, 60, 120], $tp_planet) && checkPhase([1], [9], [90, 180], $tp_planet)))
        {
            $cond1 = false;
            $cond1_1 = 0;
            $cond2 = 0;

            foreach ([0, 2, 3, 4] as $i)
            {
                if (!empty($tr_planet[$i]['phase']))
                {
                    foreach ($tr_planet[$i]['phase'] as $phase)
                    {
                        if ($phase['id'] == 9)
                        {
                            $cond1_1++;
                            if (in_array($phase['phase_e'], [90, 180]) && isset($tr_planet[$i]['phase'][$i . '-4']))
                            {
                                $cond1 = true;
                            }
                        }
                        if (in_array($phase['phase_e'], [90, 180]))
                        {
                            $cond2++;
                        }
                    }
                }
            }
            if ($cond1 == true || $cond1_1 >= 2)
            {
                if ($cond2 >= 3)
                {
                    if (checkSignHouse([1], [4, 8, 12], $tp_planet))
                    {
                        $level = 3;
                    } else
                    {
                        $level = 2;
                    }
                } elseif ($cond2 >= 1 && $cond2 < 3 && checkSignHouse([1], [4, 8, 12], $tp_planet))
                {
                    $level = 2;
                } else
                {
                    $level = 1;
                }
            }
        }
        if ($level)
        {
            $result[] = [
                'name' => $day_zhuixin,
                'star_level' => $level,
                'tips' => $day_zhuixin_des,
                'icon_url' => $icon_url5,
                'tips_url' => $icon_url5_pop
            ];
        }

        //散财之日（土豪之日）
        // tr日水火木与金星刑冲，且tr金星与日月金水火木刑冲
        // tr日水与金星刑冲，或tr金星与日月金水火木刑冲，其中至少成立一个，且日金水与2/8宫内某星合刑冲（不在“至少成立一个”的范围之内）
        // 满足以上条件之一是1星，同时满足两个条件是2星，若同时，tp月亮在2/8宫内受刑冲或与金木之一成相，或tp月金木同时成相，为3星
        // 想花钱，或有些事情需要花钱，可以享受做土豪的快感，挥金如土，也要防止财物遗失、损坏，或在买卖问题上出现纰漏
        $level = 0;

        $cond1 = false;
        $cond2 = false;
        $cond_count = 0;

        if (checkPhase([0, 2, 4, 5], [3], [90, 180], $tr_planet) && checkPhase([3], [0, 1, 2, 4, 5], [90, 180], $tr_planet))
        {
            $cond1 = true;
        }
        if (checkPhase([0, 2], [3], [90, 180], $tr_planet) || checkPhase([3], [0, 1, 2, 3, 5], [90, 180], $tr_planet))
        {
            foreach ([0, 2, 3] as $i)
            {
                if (!$cond2 && !empty($tr_planet[$i]['phase']))
                {
                    foreach ($tr_planet[$i]['phase'] as $phase)
                    {
                        if (!$cond2 && in_array($na_planet[$phase['id']]['in_house_id'], [2, 8]) && in_array($phase['phase_e'], [0, 90, 180]))
                        {
                            if (
                                (in_array($i, [0, 2]) && ($phase['phase_e'] == 0 || $phase['id'] != 3))
                                || ($i == 3 && !in_array($phase['id'], [0, 1, 2, 3, 4, 5]))
                            )
                            {
                                $cond2 = true;
                            }
                        }
                    }
                }
            }
        }
        if ($cond1) $cond_count++;
        if ($cond2) $cond_count++;

        if ($cond_count == 1)
        {
            $level = 1;
        } elseif ($cond_count == 2)
        {
            $level = 2;
        }
        $cond_3 = false;
        if (!empty($tp_planet[1]['phase']))
        {
            $cond_35 = false;
            if (isset($tp_planet[1]['phase']['1-3']) && isset($tp_planet[1]['phase']['1-5']))
            {
                $cond_35 = true;
            }
            foreach ($tp_planet[1]['phase'] as $phase)
            {
                if (
                    !$cond_3
                    &&
                    ($cond_35 === true
                        || (in_array($tp_planet[1]['in_house_id'], [2, 8]) && (in_array($phase['phase_e'], [90, 180]) || in_array($phase['id'], [3, 5])))
                    )
                )
                {
                    $cond_3 = true;
                }
            }
        }
        if ($level > 0)
        {
            if ($cond_3 === true) $level = 3;

            $result[] = [
                'name' => $day_sancai,
                'star_level' => $level,
                'tips' => $day_sancai_des,
                'icon_url' => $icon_url5,
                'tips_url' => $icon_url5_pop
            ];
        }
        //伤痛之日
        // tp月亮与火星或天王成相
        //  tr天水、水天、火水、水火刑冲同时出现两个
        //   2星
        //  tr天水、水天、火水、水火刑冲出现一个，另有一组天水、水天、水火、水火成相
        //   1星
        //    上一条不成立时才判定本条
        //  以上tr相位牵涉到6宫/1宫
        //   +1星
        //  tp月亮在6/8/12宫+1星
        //  tp月亮与火星天王之一刑冲+1星
        //  有可能会有小的意外伤，比如手脚割伤、烫伤、碾压、碰撞之类，不过一般没什么大问题，稍稍注意或做一些小手术（如拔牙）就能避免。另外出行不要匆忙，切忌开快车，偶尔会有车辆故障。与人沟通三思而后行，不要做出一些冲动的决定，免得引起争执不和。
        //伤痛之日
        //	tr天水、水天、火水、水火刑冲同时出现两个
        //		2星
        //	tr天水、水天、火水、水火刑冲出现一个，另有一组天水、水天、水火、水火成相
        //		1星
        //			上一条不成立时才判定词条
        //	tr相位牵涉到6宫/1宫
        //		+1星
        //	tp月亮与火星成相+1星
        //	小心一些小的意外伤，尤其是手脚割伤、烫伤、碾压、碰撞之类，另外出行也要注意安全，小心来往车辆。与人讲话三思而后行，不要做出一些冲动的决定，免得引起争执。
        $level = 0;
        $cond1 = 0;
        $cond2 = 0;
        $cond_12 = false;
        if (checkPhase([7], [2], [90, 180], $tr_planet))
        {
            $cond1++;
            if (in_array($tr_planet[7]['in_house_id'], [1, 6])
                || in_array($na_planet[2]['in_house_id'], [1, 6]))
            {
                $cond_12 = true;
            }
        }
        if (checkPhase([2], [7], [90, 180], $tr_planet))
        {
            $cond1++;
            if (in_array($tr_planet[2]['in_house_id'], [1, 6])
                || in_array($na_planet[7]['in_house_id'], [1, 6]))
            {
                $cond_12 = true;
            }
        }
        if (checkPhase([4], [2], [90, 180], $tr_planet))
        {
            $cond1++;
            if (in_array($tr_planet[4]['in_house_id'], [1, 6])
                || in_array($na_planet[2]['in_house_id'], [1, 6]))
            {
                $cond_12 = true;
            }
        }
        if (checkPhase([2], [4], [90, 180], $tr_planet))
        {
            $cond1++;
            if (in_array($tr_planet[2]['in_house_id'], [1, 6])
                || in_array($na_planet[4]['in_house_id'], [1, 6]))
            {
                $cond_12 = true;
            }
        }
        if ($cond1 >= 2)
        {
            $level = 2;
        } elseif ($cond1 == 1)
        {
            if (checkPhase([7], [2], [], $tr_planet))
            {
                $cond2++;
                if (in_array($tr_planet[7]['in_house_id'], [1, 6])
                    || in_array($na_planet[2]['in_house_id'], [1, 6]))
                {
                    $cond_12 = true;
                }
            }
            if (checkPhase([2], [7], [], $tr_planet))
            {
                $cond2++;
                if (in_array($tr_planet[2]['in_house_id'], [1, 6])
                    || in_array($na_planet[7]['in_house_id'], [1, 6]))
                {
                    $cond_12 = true;
                }
            }
            if (checkPhase([4], [2], [], $tr_planet))
            {
                $cond2++;
                if (in_array($tr_planet[4]['in_house_id'], [1, 6])
                    || in_array($na_planet[2]['in_house_id'], [1, 6]))
                {
                    $cond_12 = true;
                }
            }
            if (checkPhase([2], [4], [], $tr_planet))
            {
                $cond2++;
                if (in_array($tr_planet[2]['in_house_id'], [1, 6])
                    || in_array($na_planet[4]['in_house_id'], [1, 6]))
                {
                    $cond_12 = true;
                }
            }
            // 由于满足刑冲的占一组
            if ($cond2 >= 2)
            {
                $level = 1;
            }
        }

        if ($level > 0)
        {
            if ($cond_12) $level++;

            if (checkSignHouse([1], [6, 8, 12], $tp_planet)) $level++;

            if (checkPhase([1], [4, 7], [90, 180], $tp_planet)) $level++;

            if ($level > 3) $level = 3;

            $result[] = [
                'name' => $day_shangtong,
                'star_level' => $level,
//                'tips' => '小心一些小的意外伤，尤其是手脚割伤、烫伤、碾压、碰撞之类，另外出行也要注意安全，小心来往车辆。与人讲话三思而后行，不要做出一些冲动的决定，免得引起争执。',
                'tips' => $day_shangtong_des,
                'icon_url' => $icon_url5,
                'tips_url' => $icon_url5_pop
            ];
        }

        //慎戒之日（同时满足条件才成立）
        //	tr日水金火刑本命金星或tr日水火刑冲28宫内日月水金火
        //	tr5宫有  土星或海王  刑冲合本命日月金木火，或，tr火土海之一刑冲5宫内日月金木火
        //	tr8宫有  土星或海王  刑冲合本命日月金木火，或，tr火土海之一刑冲8宫内日月金木火
        //	tr火土海之一刑冲本命木星
        //	tp月亮不满足以下条件：与金木之一成非刑相且无火土海合刑冲，
        //	同时满足以上五个条件则成立1星，如此时，tp月亮在2/5/8/12宫内被火土海之一刑冲，+1星，如tp木星被火星刑冲，+1星
        //投资理财炒股，一切有关财物的投机行为都要慎重，容易出现大的起落，亏损可能性很高。另外也要小心借贷、消费引发的各种问题。
        $level = 0;
        $cond1 = $cond2 = $cond3 = $cond4 = $cond5 = false;
        if (checkPhase([0, 2, 3], [3], [90], $tr_planet)
            ||
            (
                checkSignHouse([0, 1, 2, 3, 4], [2, 8], $na_planet)
                && checkPhase([0, 2, 4], [0, 1, 2, 3, 4], [90, 180], $tr_planet)
            )
        )
        {
            $cond1 = true;
        }
        if (
            (
                checkSignHouse([6], [5], $tr_planet)
                && checkPhase([6], [0, 1, 3, 4, 5], [0, 90, 180], $tr_planet)
            )
            ||
            (
                checkSignHouse([8], [5], $tr_planet)
                && checkPhase([8], [0, 1, 3, 4, 5], [0, 90, 180], $tr_planet)
            )
            ||
            (
                checkSignHouse([0], [5], $na_planet)
                && checkPhase([4, 6, 8], [0], [90, 180], $tr_planet)
            )
            ||
            (
                checkSignHouse([1], [5], $na_planet)
                && checkPhase([4, 6, 8], [1], [90, 180], $tr_planet)
            )
            ||
            (
                checkSignHouse([3], [5], $na_planet)
                && checkPhase([4, 6, 8], [3], [90, 180], $tr_planet)
            )
            ||
            (
                checkSignHouse([4], [5], $na_planet)
                && checkPhase([4, 6, 8], [4], [90, 180], $tr_planet)
            )
            ||
            (
                checkSignHouse([5], [5], $na_planet)
                && checkPhase([4, 6, 8], [5], [90, 180], $tr_planet)
            )
        )
        {
            $cond2 = true;
        }
        if (
            (
                checkSignHouse([6], [8], $tr_planet)
                && checkPhase([6], [0, 1, 3, 4, 5], [0, 90, 180], $tr_planet)
            )
            ||
            (
                checkSignHouse([8], [8], $tr_planet)
                && checkPhase([8], [0, 1, 3, 4, 5], [0, 90, 180], $tr_planet)
            )
            ||
            (
                checkSignHouse([0], [8], $na_planet)
                && checkPhase([4, 6, 8], [0], [90, 180], $tr_planet)
            )
            ||
            (
                checkSignHouse([1], [8], $na_planet)
                && checkPhase([4, 6, 8], [1], [90, 180], $tr_planet)
            )
            ||
            (
                checkSignHouse([3], [8], $na_planet)
                && checkPhase([4, 6, 8], [3], [90, 180], $tr_planet)
            )
            ||
            (
                checkSignHouse([4], [8], $na_planet)
                && checkPhase([4, 6, 8], [4], [90, 180], $tr_planet)
            )
            ||
            (
                checkSignHouse([5], [8], $na_planet)
                && checkPhase([4, 6, 8], [5], [90, 180], $tr_planet)
            )
        )
        {
            $cond3 = true;
        }
        if (checkPhase([4, 6, 8], [5], [90, 180], $tr_planet))
        {
            $cond4 = true;
        }
        if (checkPhase([1], [3, 5], [90], $tp_planet) || checkPhase([1], [4, 6, 8], [0, 90, 180], $tp_planet))
        {
            $cond5 = true;
        }
        //	同时满足以上五个条件则成立1星，如此时，tp月亮在2/5/8/12宫内被火土海之一刑冲，+1星，如tp木星被火星刑冲，+1星
        if ($cond1 && $cond2 && $cond3 && $cond4 && $cond5)
        {
            $level = 1;

            if (checkSignHouse([1], [2, 5, 8, 12], $tp_planet) && checkPhase([1], [4, 6, 8], [90, 180], $tp_planet))
            {
                $level++;
            }
            if (checkPhase([5], [4], [90, 180], $tp_planet))
            {
                $level++;
            }
        }
        if ($level > 0)
        {
            $result[] = [
                'name' => $day_chenjie,
                'star_level' => $level,
                'tips' => $day_chenjie_des,
                'icon_url' => $icon_url5,
                'tips_url' => $icon_url5_pop
            ];
        }


        //许愿之日
        //	天象日月合（需判断精确合相发生在本日内）
        //		3星，但显示次序次于其它3星
        //	（某某座）新月到来，今天适合你找个安静的时间，许下心愿，你可以向这次新月祈祷有关（）、（）等方面的事情，相信你愿望所在，一切美好都会慢慢实现～
        //		新月在1宫
        //			健康、个人发展
        //		2宫
        //			财富、价值
        //		3宫
        //			学习、出行
        //		4宫
        //			父母、房产
        //		5宫
        //			恋爱、子女、财富
        //		6宫
        //			工作、健康、宠物
        //		7宫
        //			恋爱、婚姻、合作
        //		8宫
        //			财富、健康、平安
        //		9宫
        //			学习、旅行、出国
        //		10宫
        //			事业、名声
        //		11宫
        //			财富、交友、贵人
        //		12宫
        //			消灾解难、心灵成长
        $area = [
            1 => '健康、个人发展',
            2 => '财富、价值',
            3 => '学习、出行',
            4 => '父母、房产',
            5 => '恋爱、子女、财富',
            6 => '工作、健康、宠物',
            7 => '恋爱、婚姻、合作',
            8 => '财富、健康、平安',
            9 => '学习、旅行、出国',
            10 => '事业、名声',
            11 => '财富、交友、贵人',
            12 => '消灾解难、心灵成长',
        ];
        if ($this->newMoonSign > 0)
        {
            $level = 3;

            // 日月发生合相 取月亮的星座宫位即可
            // $in_sign_id = $tr_planet[1]['in_sign_id'];
//            $in_sign_id = $this->newMoonSign;
            // 新月星盘数据
            $in_sign_id = $this->newMoonTransitsData[1]['planets'][1]['in_sign_id'];
            $in_house_id = $this->newMoonTransitsData[1]['planets'][1]['in_house_id'];

            $sign = explode('|', config('astrolog.sign_name')[$in_sign_id])[3];

            $result[] = [
                'name' => '许愿之日',
                'star_level' => $level,
                'tips' => $sign . '新月到来，今天适合你找个安静的时间，许下心愿，你可以向这次新月祈祷有关' . $area[$in_house_id] . '等方面的事情，相信你愿望所在，一切美好都会慢慢实现～',
                'icon_url' => $icon_url6,
                'tips_url' => $icon_url6_pop
            ];
        }


        //烙印之日
        //	当日发生日月食：日月精准合或日月精准冲，且南交点或北交点在太阳左右15度内
        //		若该食点（约为太阳度数）与本命日月金水火升顶之一合相1度内3星，合大于1度或刑冲1度内2星，3度内刑冲或1度内拱六分1星；
        //      若该食点未与本命日月金水火成相，与本命木土天海冥两座以上成相，1星，如有星在1宫或有1度内合相，2星
        //	一个宏大的宇宙天象将在你生命中留下烙印，催动你想去做些什么，很久没下的决心可能会在此后下定，很久没做的事情也会在最近完成。哪怕你毫无想法，也会受到一些莫名的影响，推着你走向截然不同的命运。也许是契机，也许是挑战。最近半个月的时间，说不定会发生一些影响深远的大事件，一定要做好准备。
        $level = 0;
        if ($this->solarEclipse !== false)
        {
            $solarTransitsPlanets = $this->solarTransitsData[1]['planets'];
            if (checkPhase([0], [0, 1, 2, 3, 4, ASC, MC], [0], $solarTransitsPlanets, 1))
            {
                $level = 3;
            } elseif ($level < 2 && (checkPhase([0], [0, 1, 2, 3, 4, ASC, MC], [0], $solarTransitsPlanets)
                    || checkPhase([0], [0, 1, 2, 3, 4, ASC, MC], [90, 180], $solarTransitsPlanets, 1)))
            {
                $level = 2;
            } elseif ($level < 1 && (checkPhase([0], [0, 1, 2, 3, 4, ASC, MC], [90, 180], $solarTransitsPlanets, 3)
                    || checkPhase([0], [0, 1, 2, 3, 4, ASC, MC], [60, 120], $solarTransitsPlanets, 1)))
            {
                $level = 1;
            }
            if ($level < 2 && !checkPhase([0], [0, 1, 2, 3, 4], [], $solarTransitsPlanets))
            {
                $phase_num = 0;
                $cond = false;
                if (!empty($solarTransitsPlanets[0]['phase']))
                {
                    foreach ($solarTransitsPlanets[0]['phase'] as $phase)
                    {
                        if (in_array($phase['id'], [5, 6, 7, 8, 9]))
                        {
                            $phase_num++;
                            if ($solarTransitsPlanets[$phase['id']]['in_house_id'] == 1
                                || ($phase['phase_e'] == 0 && $phase['phase_orb'] < 1))
                            {
                                $cond = true;
                            }
                        }
                    }
                }
                if ($level <= 1 && $phase_num >= 2)
                {
                    $level = 1;

                    if ($level < 2 && $cond)
                    {
                        $level = 2;
                    }
                }
            }
        }
        if ($level < 3 && $this->lunarEclipse !== false)
        {
            $lunarTransitsPlanets = $this->lunarTransitsData[1]['planets'];
            if (checkPhase([0], [0, 1, 2, 3, 4, ASC, MC], [0], $lunarTransitsPlanets, 1))
            {
                $level = 3;
            } elseif ($level < 2 && (checkPhase([0], [0, 1, 2, 3, 4, ASC, MC], [0], $lunarTransitsPlanets)
                    || checkPhase([0], [0, 1, 2, 3, 4, ASC, MC], [90, 180], $lunarTransitsPlanets, 1)))
            {
                $level = 2;
            } elseif ($level < 1 && (checkPhase([0], [0, 1, 2, 3, 4, ASC, MC], [90, 180], $lunarTransitsPlanets, 3)
                    || checkPhase([0], [0, 1, 2, 3, 4, ASC, MC], [60, 120], $lunarTransitsPlanets, 1)))
            {
                $level = 1;
            }
            if ($level < 2 && !checkPhase([0], [0, 1, 2, 3, 4], [], $lunarTransitsPlanets))
            {
                $phase_num = 0;
                $cond = false;
                if (!empty($lunarTransitsPlanets[0]['phase']))
                {
                    foreach ($lunarTransitsPlanets[0]['phase'] as $phase)
                    {
                        if (in_array($phase['id'], [5, 6, 7, 8, 9]))
                        {
                            $phase_num++;
                            if ($lunarTransitsPlanets[$phase['id']]['in_house_id'] == 1
                                || ($phase['phase_e'] == 0 && $phase['phase_orb'] < 1))
                            {
                                $cond = true;
                            }
                        }
                    }
                }
                if ($level <= 1 && $phase_num >= 2)
                {
                    $level = 1;

                    if ($level < 2 && $cond)
                    {
                        $level = 2;
                    }
                }
            }
        }
        if ($level)
        {
            $result[] = [
                'name' => $day_laoyin,
                'star_level' => $level,
                'tips' => $day_laoyin_des,
                'icon_url' => $icon_url6,
                'tips_url' => $icon_url6_pop
            ];
        }


        //自由之日
        //	tp月亮空相，且tr日水金火都没有与本命日月水金火形成相位【1星，若tr日水金火与本命各星都没有相位，2星】
        //	据说这是个神奇的日子，你暂时脱离了行星的影响，作为一个自由的生命而存在，我们难以预料你会经历什么，你可以尽己所能地去发挥创造。这是完全属于你自己的一天。
        $level = 0;
        if (empty($tp_planet[1]['phase']) && !checkPhase([0, 2, 3, 4], [0, 1, 2, 3, 4], [], $tr_planet))
        {
            $level = 1;
            if (empty($tr_planet[0]['phase']) && empty($tr_planet[2]['phase']) && empty($tr_planet[3]['phase']) && empty($tr_planet[4]['phase']))
            {
                $level = 2;
            }
        }
        if ($level)
        {
            $result[] = [
                'name' => $day_ziyou,
                'star_level' => $level,
                'tips' => $day_ziyou_des,
                'icon_url' => $icon_url7,
                'tips_url' => $icon_url7_pop
            ];
        }


        //平凡之日
        //	没有其它，都是1星
        //	今天没有明显的预示，但并不意味着什么都不会发生。时间与生命的奥秘太多，需要我们一直不断的去探索和破解。而对您来说，平凡的日子也注定了不凡，一步一个脚印，才能踏上你的辉煌人生。
        if (empty($result)
            ||
            (count($result) == 1 && in_array($result[0]['name'], ['学习之日', '瘦身之日', '健身之日']))
            ||
            (count($result) == 2 && in_array($result[0]['name'], ['学习之日', '瘦身之日', '健身之日'])
                && in_array($result[1]['name'], ['学习之日', '瘦身之日', '健身之日']))
        )
        {
            if ($levels[0] > 0)
            {
                $result[] = [
                    'name' => $day_chuansuo,
                    'star_level' => $levels[0],
                    'tips' => $day_chuansuo_des,
                    'icon_url' => $icon_url7,
                    'tips_url' => $icon_url7_pop
                ];
            }
            if ($levels[1] > 0)
            {
                $result[] = [
                    'name' => $day_yaoyue,
                    'star_level' => $levels[1],
                    'tips' => $day_yaoyue_des,
                    'icon_url' => $icon_url7,
                    'tips_url' => $icon_url7_pop
                ];
            }
            if ($levels[2] > 0)
            {
                // 愤怒郁闷均低于1级  改为 愤怒郁闷加起来小于5分 20180910
                if ($this->fiveIndexScore[3] + $this->fiveIndexScore[4] < 5)
                {
                    $result[] = [
                        'name' => $day_yuyue,
                        'star_level' => $levels[2],
                        'tips' => $day_yuyue_des,
                        'icon_url' => $icon_url1,
                        'tips_url' => $icon_url1_pop
                    ];
                } // 缭乱之日（愤怒+郁闷+开心，级别之和除以2向下取整）
                elseif ($levels[3] <= $levels[2] && $levels[4] <= $levels[2])
                {
                    $result[] = [
                        'name' => $day_liaoluan,
                        'star_level' => floor(($levels[2] + $levels[3] + $levels[4]) / 2),
                        'tips' => $day_liaoluan_des,
                        'icon_url' => $icon_url7,
                        'tips_url' => $icon_url7_pop
                    ];
                }
            }
            if ($levels[3] > 0)
            {
                if ($levels[2] < 1)
                {
                    $result[] = [
                        'name' => $day_jifen,
                        'star_level' => $levels[3],
                        'tips' => $day_jifen_des,
                        'icon_url' => $icon_url7,
                        'tips_url' => $icon_url7_pop
                    ];
                }
            }
            if ($levels[4] > 0)
            {
                if ($levels[2] < 1)
                {
                    $levels4 = $levels[4];
                    // 20180911 沉郁之日记分，如果tr日金水与木星成相，同时日金水之一与天王星或金星成拱六分相，则沉郁之日减1星，零星则不显示
                    if (checkPhase([0, 2, 3], [5], [], $tr_planet) && checkPhase([0, 2, 3], [3, 7], [0, 60, 120], $tr_planet))
                    {
                        $levels4--;
                    }
                    if ($levels4 > 0)
                    {
                        $result[] = [
                            'name' => $day_chenyu,
                            'star_level' => $levels[4],
                            'tips' => $day_chenyu_des,
                            'icon_url' => $icon_url7,
                            'tips_url' => $icon_url7_pop
                        ];
                    }
                }
            }

            $level = 1;

            if (empty($result))
            {
                $result[] = [
                    'name' => $day_pingfan,
                    'star_level' => $level,
                    'tips' => $day_pingfan_des,
                    'icon_url' => $icon_url7,
                    'tips_url' => $icon_url7_pop
                ];
            }
        }
        return $result;
    }

    protected function getNormal()
    {
        $tr_planet1 = $this->transitsData[1]['planets'];// 行运外盘数据 -天象
        $tr_planet2 = $this->transitsData[0]['planets'];// 行运内盘数据 -本命
        $tp_planet = $this->thirdprogressedData['planets'];// 三限盘

        // 出行 社交/桃花 开心 愤怒/意外 郁闷
        $score1 = $score2 = $score3 = $score4 = $score5 = 0;
        $score1_num = $score2_num = $score3_num = $score4_num = $score5_num = 0;
        // 遍历日月水金火
        foreach ([0, 1, 2, 3, 4] as $i)
        {
            if (!empty($tr_planet1[$i]['phase']))
            {
                foreach ($tr_planet1[$i]['phase'] as $phase)
                {
                    if ($i == 0)
                    {
                        if ($phase['phase_e'] != 90)
                        {
                            // 日水非刑
                            if ($phase['id'] == 2)
                            {
                                $score1 += 4;
                                $score1_num++;
                            } // 日金非刑
                            elseif ($phase['id'] == 3)
                            {
                                $score2 += 5;
                                $score2_num++;
                                //日金合拱六分
                                if (in_array($phase['phase_e'], [0, 60, 120]))
                                {
                                    $score3 += 5;
                                    $score3_num++;
                                } // 日金冲
                                else
                                {
                                    $score3 += 3;
                                    $score3_num++;
                                }
                            } // 日火
                            elseif ($phase['id'] == 4)
                            {
                                if ($phase['phase_e'] == 0)
                                {
                                    $score4 += 4;
                                    $score4_num++;
                                } // 拱六分
                                elseif (in_array($phase['phase_e'], [60, 120]))
                                {
                                    $score4 += 3;
                                    $score4_num++;
                                }
                            }
                            // 日木非刑
                            if ($phase['id'] == 5)
                            {
                                $score1 += 5;
                                $score1_num++;
                                //日木合拱六分
                                if (in_array($phase['phase_e'], [0, 60, 120]))
                                {
                                    $score3 += 5;
                                    $score3_num++;
                                } // 日木冲
                                else
                                {
                                    $score3 += 4;
                                    $score3_num++;
                                }
                            }
                            // 日土/日海/日冥合
                            if (in_array($phase['id'], [6, 8, 9]))
                            {
                                if ($phase['phase_e'] == 0)
                                {
                                    $score5 += 4;
                                    $score5_num++;
                                } elseif (in_array($phase['phase_e'], [60, 120]))
                                {
                                    // 日土/日海/日冥拱六分
                                    $score5 += 3;
                                    $score5_num++;
                                }
                            }
                            if ($phase['id'] == 1 && $phase['phase_e'] == 180)
                            {
                                $score5 += 1;
                                $score5_num++;
                            }
                        } else
                        {
                            if ($phase['id'] == 1)
                            {
                                $score5 += 3;
                                $score5_num++;
                            } // 日水刑
                            elseif ($phase['id'] == 2)
                            {
                                $score1 += 1;
                                $score1_num++;
                                $score5 += 3;
                                $score5_num++;
                            } // 日金刑
                            elseif ($phase['id'] == 3)
                            {
                                $score2 += 1;
                                $score2_num++;
                                $score5 += 1;
                                $score5_num++;
                            } // 日木刑
                            elseif ($phase['id'] == 5)
                            {
                                $score1 += 1;
                                $score1_num++;
                                $score5 += 1;
                                $score5_num++;
                            }
                        }
                        if (in_array($phase['phase_e'], [90, 180]))
                        {
                            // 日火刑冲
                            if ($phase['id'] == 4)
                            {
                                $score4 += 5;
                                $score4_num++;
                            } elseif ($phase['id'] == 7)
                            {
                                $score5 += 3;
                                $score5_num++;
                            } // 日土/日海/日冥刑冲
                            elseif (in_array($phase['id'], [6, 8, 9]))
                            {
                                $score5 += 5;
                                $score5_num++;
                            }
                        }
                    } elseif ($i == 1)
                    {
                        if ($phase['phase_e'] != 90)
                        {
                            // 月水合拱六分
                            if ($phase['id'] == 2)
                            {
                                if (in_array($phase['phase_e'], [0, 60, 120]))
                                {
                                    $score1 += 0.5;
                                    $score1_num++;
                                }
                            } // 月金合拱六分
                            elseif ($phase['id'] == 3)
                            {
                                $score3 += 0.5;
                                $score3_num++;
                                if (in_array($phase['phase_e'], [0, 60, 120]))
                                {
                                    $score2 += 0.5;
                                    $score2_num++;
                                }
                            } // 月木合拱六分
                            elseif ($phase['id'] == 5)
                            {
                                $score3 += 0.5;
                                $score3_num++;
                                if (in_array($phase['phase_e'], [0, 60, 120]))
                                {
                                    $score1 += 0.5;
                                    $score1_num++;
                                }
                            }
                        } // 月与任意星体刑
                        else
                        {
                            $score5 += 0.5;
                            $score5_num++;
                        }
                        // 月火
                        if ($phase['id'] == 4)
                        {
                            $score4 += 0.5;
                            $score4_num++;
                        }
                    } elseif ($i == 2)
                    {
                        if ($phase['phase_e'] != 90)
                        {
                            // 水日非刑
                            if ($phase['id'] == 0)
                            {
                                $score1 += 4;
                                $score1_num++;
                            } // 水月非刑
                            elseif ($phase['id'] == 1)
                            {
                                $score1 += 4;
                                $score1_num++;
                            } // 水金非刑
                            elseif ($phase['id'] == 3)
                            {
                                $score1 += 1;
                                $score1_num++;
                                $score2 += 4;
                                $score2_num++;
                                // 水金合拱六分
                                if (in_array($phase['phase_e'], [0, 60, 120]))
                                {
                                    $score3 += 3;
                                    $score3_num++;
                                } // 水木/水金冲
                                else
                                {
                                    $score3 += 1;
                                    $score3_num++;
                                }
                            } elseif ($phase['id'] == 4)
                            {
                                // 水火合拱六分
                                if (in_array($phase['phase_e'], [0, 60, 120]))
                                {
                                    $score4 += 3;
                                    $score4_num++;
                                }
                            } // 水木非刑
                            elseif ($phase['id'] == 5)
                            {
                                $score1 += 5;
                                $score1_num++;
                                //水木合拱六分
                                if (in_array($phase['phase_e'], [0, 60, 120]))
                                {
                                    $score3 += 3;
                                    $score3_num++;
                                } // 水木/水金冲
                                else
                                {
                                    $score3 += 1;
                                    $score3_num++;
                                }
                            }
                            if (in_array($phase['phase_e'], [0, 180]))
                            {
                                // 水星合上升下降
                                if ($phase['id'] == ASC)
                                {
                                    $score1 += 4;
                                    $score1_num++;
                                } // 水星合天顶天底
                                elseif ($phase['id'] == MC)
                                {
                                    $score1 += 3;
                                    $score1_num++;
                                }
                            }
                        } else
                        {
                            // 水日刑
                            if ($phase['id'] == 0)
                            {
                                $score1 += 3;
                                $score1_num++;
                                $score5 += 3;
                                $score5_num++;
                            } // 水月刑
                            elseif ($phase['id'] == 1)
                            {
                                $score1 += 3;
                                $score1_num++;
                            } elseif ($phase['id'] == 3)
                            {
                                $score5 += 1;
                                $score5_num++;
                            } // 水木刑
                            elseif ($phase['id'] == 5)
                            {
                                $score1 += 1;
                                $score1_num++;
                                $score5 += 1;
                                $score5_num++;
                            }
                        }
                        if (in_array($phase['phase_e'], [90, 180]))
                        {
                            // 水火
                            if ($phase['id'] == 4)
                            {
                                $score4 += 4;
                                $score4_num++;
                            } elseif ($phase['id'] == 7)
                            {
                                $score5 += 3;
                                $score5_num++;
                            } // 水土/水海/水冥刑冲
                            elseif (in_array($phase['id'], [6, 8, 9]))
                            {
                                $score5 += 4;
                                $score5_num++;
                            }
                        }
                        // 水土/水海/水冥合
                        if (in_array($phase['id'], [6, 8, 9]) && $phase['phase_e'] == 0)
                        {
                            $score5 += 3;
                            $score5_num++;
                        }
                    } elseif ($i == 3)
                    {
                        if ($phase['phase_e'] != 90)
                        {
                            // 金日非刑
                            if ($phase['id'] == 0)
                            {
                                $score2 += 5;
                                $score2_num++;
                                // 金日合拱六分
                                if (in_array($phase['phase_e'], [0, 60, 120]))
                                {
                                    $score3 += 5;
                                    $score3_num++;
                                } // 金日冲
                                else
                                {
                                    $score3 += 3;
                                    $score3_num++;
                                }
                            } // 金月非刑
                            elseif ($phase['id'] == 1)
                            {
                                $score2 += 5;
                                $score2_num++;
                                // 金月合拱六分
                                if (in_array($phase['phase_e'], [0, 60, 120]))
                                {
                                    $score3 += 5;
                                    $score3_num++;
                                } // 金月冲
                                else
                                {
                                    $score3 += 3;
                                    $score3_num++;
                                }
                            } // 金水非刑
                            elseif ($phase['id'] == 2)
                            {
                                $score2 += 4;
                                $score2_num++;
                                // 金水合拱六分
                                if (in_array($phase['phase_e'], [0, 60, 120]))
                                {
                                    $score3 += 3;
                                    $score3_num++;
                                } // 金木/金水冲
                                else
                                {
                                    $score3 += 1;
                                    $score3_num++;
                                }
                            } // 金金非刑
                            elseif ($phase['id'] == 3)
                            {
                                $score2 += 5;
                                $score2_num++;
                                // 金金合拱六分
                                if (in_array($phase['phase_e'], [0, 60, 120]))
                                {
                                    $score3 += 5;
                                    $score3_num++;
                                }
                            } elseif ($phase['id'] == 4)
                            {
                                // 金火合拱六分
                                if (in_array($phase['phase_e'], [0, 60, 120]))
                                {
                                    $score2 += 4;
                                    $score2_num++;
                                    $score4 += 3;
                                    $score4_num++;
                                }
                            } // 金木非刑
                            elseif ($phase['id'] == 5)
                            {
                                $score1 += 1;
                                $score1_num++;
                                $score2 += 2;
                                $score2_num++;
                                // 金木合拱六分
                                if (in_array($phase['phase_e'], [0, 60, 120]))
                                {
                                    $score3 += 3;
                                    $score3_num++;
                                } // 金木/金水冲
                                else
                                {
                                    $score3 += 1;
                                    $score3_num++;
                                }
                            } elseif ($phase['id'] == ASC)
                            {
                                // 金合上升/下降
                                if (in_array($phase['phase_e'], [0, 180]))
                                {
                                    $score2 += 5;
                                    $score2_num++;
                                    $score3 += 5;
                                    $score3_num++;
                                }
                            } elseif ($phase['id'] == MC)
                            {
                                // 金合天顶天底
                                if (in_array($phase['phase_e'], [0, 180]))
                                {
                                    $score2 += 4;
                                    $score2_num++;
                                }
                            }
                            // 金土/金海/金冥合
                            if (in_array($phase['id'], [6, 8, 9]) && $phase['phase_e'] == 0)
                            {
                                $score5 += 3;
                                $score5_num++;
                            }
                        } else
                        {
                            if ($phase['id'] == 0)
                            {
                                $score2 += 1;
                                $score2_num++;
                                $score5 += 1;
                                $score5_num++;
                            } elseif ($phase['id'] == 1)
                            {
                                $score2 += 1;
                                $score2_num++;
                            } elseif ($phase['id'] == 2)
                            {
                                $score2 += 1;
                                $score2_num++;
                                $score5 += 1;
                                $score5_num++;
                            } elseif ($phase['id'] == 3)
                            {
                                $score2 += 1;
                                $score2_num++;
                            } elseif ($phase['id'] == 5)
                            {
                                $score2 += 1;
                                $score2_num++;
                                $score5 += 1;
                                $score5_num++;
                            }
                        }
                        if (in_array($phase['phase_e'], [90, 180]))
                        {
                            // 金火
                            if ($phase['id'] == 4)
                            {
                                $score4 += 4;
                                $score4_num++;
                            } elseif ($phase['id'] == 7)
                            {
                                $score5 += 3;
                                $score5_num++;
                            } // 金土/金海/金冥刑冲
                            elseif (in_array($phase['id'], [6, 8, 9]))
                            {
                                $score5 += 4;
                                $score5_num++;
                            }
                        }
                    } elseif ($i == 4)
                    {
                        if (in_array($phase['phase_e'], [90, 180]))
                        {
                            // 火日刑冲
                            if ($phase['id'] == 0)
                            {
                                $score4 += 5;
                                $score4_num++;
                            } // 火月刑冲
                            elseif ($phase['id'] == 1)
                            {
                                $score4 += 5;
                                $score4_num++;
                            } // 火水
                            elseif ($phase['id'] == 2)
                            {
                                $score4 += 4;
                                $score4_num++;
                            } // 火金
                            elseif ($phase['id'] == 3)
                            {
                                $score4 += 4;
                                $score4_num++;
                            } // 与木土天海冥
                            elseif (in_array($phase['id'], [5, 6, 7, 8, 9]))
                            {
                                $score4 += 1;
                                $score4_num++;
                            }
                            // 刑上升下降
                            if ($phase['phase_e'] == 90 && $phase['id'] == ASC)
                            {
                                $score4 += 1;
                                $score4_num++;
                            }
                            // 火刑冲命宫内星
                            if ($tr_planet2[$phase['id']]['in_house_id'] == 1)
                            {
                                $score4 += 1;
                                $score4_num++;
                            }
                        } // 拱六分
                        elseif (in_array($phase['phase_e'], [60, 120]))
                        {
                            if ($phase['id'] == 0)
                            {
                                $score4 += 3;
                                $score4_num++;
                            } elseif ($phase['id'] == 1)
                            {
                                $score4 += 3;
                                $score4_num++;
                            }
                        }
                        if (in_array($phase['phase_e'], [0, 180]))
                        {
                            // 火合升降
                            if ($phase['id'] == ASC)
                            {
                                $score4 += 5;
                                $score4_num++;
                            } // 天顶天底
                            elseif ($phase['id'] == MC)
                            {
                                $score4 += 3;
                                $score4_num++;
                            }
                        }
                        if ($phase['phase_e'] == 0)
                        {
                            // 火日
                            if ($phase['id'] == 0)
                            {
                                $score4 += 4;
                                $score4_num++;
                            } // 火月
                            elseif ($phase['id'] == 1)
                            {
                                $score4 += 4;
                                $score4_num++;
                            }

                        }
                        // 合拱六分
                        if (in_array($phase['phase_e'], [0, 60, 120]))
                        {
                            // 火水
                            if ($phase['id'] == 2)
                            {
                                $score4 += 3;
                                $score4_num++;
                            }
                        }
                    }
                    if (in_array($i, [0, 1, 2, 3]))
                    {
                        if (in_array($phase['phase_e'], [0, 60, 120]))
                        {
                            // 日月金水与3/9宫宫内星合拱六分
                            if (in_array($tr_planet2[$phase['id']]['in_house_id'], [3, 9]))
                            {
                                $score1 += 3;
                                $score1_num++;
                            } elseif (in_array($tr_planet2[$phase['id']]['in_house_id'], [5, 7, 11]))
                            {
                                $score2 += 2;
                                $score2_num++;
                            }

                        }
                    }
                }
            }
            if (in_array($i, [0, 2, 3]))
            {
                if ($tr_planet1[$i]['in_house_id'] == 12)
                {
                    $score5 += 2;
                    $score5_num++;
                } elseif ($tr_planet1[$i]['in_house_id'] == 8)
                {
                    $score5 += 1;
                    $score5_num++;
                }
            }
            if (in_array($i, [0, 1, 2, 3]))
            {
                // 日月金水落3/9宫
                if (in_array($tr_planet1[$i]['in_house_id'], [3, 9]))
                {
                    $score1 += 1;
                    $score1_num++;
                } elseif (in_array($tr_planet1[$i]['in_house_id'], [5, 7, 11]))
                {
                    $score2 += 1;
                    $score2_num++;
                }

            } // 火星
            else
            {
                // 火落1/7
                if (in_array($tr_planet2[$i]['in_house_id'], [1, 7]))
                {
                    $score4 += 1;
                    $score4_num++;
                }
            }
        }

        $level1 = $level2 = $level3 = $level4 = $level5 = 0;

        $tp1_phase4689_num = 0;
        $tp1_phase4689_090180_num = 0;
        $tp1_phase6789_num = 0;
        $tp1_phase6789_90180_num = 0;

        if (!empty($tp_planet[1]['phase']))
        {
            foreach ($tp_planet[1]['phase'] as $phase)
            {
                if (in_array($phase['id'], [4, 6, 8, 9]))
                {
                    $tp1_phase4689_num++;
                    if (in_array($phase['phase_e'], [0, 90, 180]))
                    {
                        $tp1_phase4689_090180_num++;
                    }
                }
                if (in_array($phase['id'], [6, 7, 8, 9]))
                {
                    $tp1_phase6789_num++;
                    if (in_array($phase['phase_e'], [90, 180]))
                    {
                        $tp1_phase6789_90180_num++;
                    }
                }
            }
        }

        if ($score1 >= 9 || $score1_num >= 4)
        {
            $level1 = 2;
            if (in_array($tp_planet[1]['in_house_id'], [3, 9])
                || (checkPhase([1], [2, 5], [0, 60, 120, 180], $tp_planet)))
            {
                $level1 = 3;
            }
        } elseif ($score1 >= 5 || $score1_num >= 3)
        {
            $level1 = 1;
        }

        if ($score2 >= 9 || $score2_num >= 4)
        {
            $level2 = 2;
            if (in_array($tp_planet[1]['in_house_id'], [5, 7, 11])
                || (checkPhase([1], [3, 5], [0, 60, 120, 180], $tp_planet)))
            {
                $level2 = 3;
            }
        } elseif ($score2 >= 5 || $score2_num >= 3)
        {
            $level2 = 1;
        }

        if ($score3 >= 9 || $score3_num >= 4)
        {
            $level3 = 2;
            if ($tp1_phase4689_090180_num == 0 || $tp1_phase4689_num < 2)
            {
                $level3 = 3;
            }
        } elseif ($score3 >= 5 || $score3_num >= 3)
        {
            $level3 = 1;
        }

        if ($score4 >= 9 || $score4_num >= 4)
        {
            $level4 = 2;
            if ($tp1_phase6789_num >= 2 || (checkPhase([1], [4], [], $tp_planet)))
            {
                $level4 = 3;
            }
        } elseif ($score4 >= 5 || $score4_num >= 3)
        {
            $level4 = 1;
        }

        if ($score5 >= 9 || $score5_num >= 4)
        {
            $level5 = 2;
            if ($tp1_phase6789_90180_num >= 1 || $tp1_phase6789_num >= 2)
            {
                $level5 = 3;
            }
        } elseif ($score5 >= 5 || $score5_num >= 3)
        {
            $level5 = 1;
        }

        $result = [$level1, $level2, $level3, $level4, $level5];

        $this->fiveIndex = $result;
        $this->fiveIndexScore = [$score1, $score2, $score3, $score4, $score5];

        return $result;
    }
}
